	// var host = 'http://106.14.57.180:8001';
	// var host = "http://192.168.6.223:1234";
	var host = "http://114.215.252.114:8000";
	var imghost = 'http://114.215.252.114:8001';
	// var imghost = 'http://106.14.57.180:8001';
	var order_num = '';
	var orderNum = '';
	var resall = '';
	if ($.cookie('permisssion')) {
	    var permission = $.cookie('permisssion').split(',');
	}
	//分页
	var bstop = true;
	var tstop = true;
	var astop = true;
	var cstop = true;
	var GG = {
	    "kk": function(mm) {
	        if (tstop) {
	            channelall.paddingList(mm);
	        }

	    }
	}
	var DD = {
	    "HH": function(mm) {
	        if (cstop) {
	            channelall.orderlist(mm);
	        }

	    }
	}

	var myDate = new Date();
	//获取当前年
	var year = myDate.getFullYear();
	//获取当前月
	var month = myDate.getMonth() + 1;
	//获取当前日
	var a = myDate.getDate();
	var d = new Date();
	d.setTime(d.getTime() - 24 * 60 * 60 * 1000);
	var now = d.getFullYear() + "-" + p(d.getMonth() + 1) + "-" + p(d.getDate());
	var nowtwo = year + '-' + p(month) + "-" + p(a);
	// socket = new WebSocket("ws://192.168.6.235:1234/channel/")

	// socket.onmessage = function(evt) {
	// 	console.log(evt.data);
	// }

	// socket.onopen = function(evt) {
	// 	console.log("ok");
	// }

	$(function() {
	    $(window).scrollTop(0);
	    $("#myID").flatpickr();
	    channelall.selectProvince();
	    channelall.personalCenter();
	    $('.channel_height').css('minHeight', $(document).height() - 62);
	    $('.channel-ask-height').css('minHeight', $(document).height() - 62);
	    $('.product-list').css('minHeight', $(document).height() - 147);
	    // $('.pending-select-content').css('minHeight', $(document).height() - 147);
	    $('.pending-orders-content').css('minHeight', $(document).height() - 147);
	    $('.pending-orders-content').css('minHeight', $(document).height() - 147);
	    $('.channel-personal-bottom').css('minHeight', $(document).height() - 440);
	    if ($.cookie('permisssion')) {
	        for (var i = 0; i < permission.length; i++) {
	            $('.' + permission[i] + '').show();
	        }
	    }
	    $('#datepicker').val(now);
	    $('#datepicker-2').val(nowtwo);
	    productname('.prodect-1');

	    // --------------------------------nav click----------------------------

	    $('.channel-header-click').on('click', function() {
	        $(this).addClass('nav-color').siblings().removeClass('nav-color');
	        $('.channel-tab').eq($(this).index() - 1).show().siblings('.channel-tab').hide();
	    });
	    //-----------------------------首页------------------------------------
	    $('.channel-header-click').eq(0).on('click', function() {
	        $('.channel-content-click').eq(0).click();
	    });
	    //	------------------------------申请----------------------
	    $('.channel-header-click').eq(1).on('click', function() {
	        $('.channel-content-click').eq(5).click();
	    });
	    $('select').focus(function() {
	        $('.kongbai').hide();
	    });
	    //	---------------产品列表---------------------------
	    $('.channel-header-click').eq(2).on('click', function() {
	        $.ajax({
	            type: "post",
	            url: host + "/channel/product/",
	            async: true,
	            contentType: "application/json; charset=utf-8",
	            datatpye: 'json',
	            beforeSend: function(request) {
	                var channeltoken = $.cookie('channeltoken');
	                request.setRequestHeader("authorization", channeltoken);
	            },
	            success: function(res) {
	                console.log(res);
	                $('.protr').remove();
	                var btr = '';
	                var len = res.data.length;
	                var state = '';
	                for (var i = 0; i < len; i++) {
	                    var yearrates = [];
	                    var servicefees = [];
	                    if (res.data[i].state[1]) {
	                        state = res.data[i].state[1];
	                    }
	                    if (res.data[i].state[0]) {
	                        state = res.data[i].state[0];
	                    }
	                    for (var k = 0; k < res.data[i].yearrate.length; k++) {
	                        for (var j = 0; j < res.data[i].yearrate[k].rate.length; j++) {
	                            yearrates.push(res.data[i].yearrate[k].rate[j].rate);
	                        }
	                    }
	                    for (var k = 0; k < res.data[i].servicefee.length; k++) {
	                        for (var j = 0; j < res.data[i].servicefee[k].rate.length; j++) {
	                            servicefees.push(res.data[i].servicefee[k].rate[j].rate);
	                        }
	                    }
	                    servicefees.join(',');
	                    btr += '<tr class="protr">' +
	                        '<td>' + res.data[i].name + '</td>' +
	                        '<td>' + yearrates + '</td>' +
	                        '<td>' + res.data[i].totalamount + '</td>' +
	                        '<td>' + res.data[i].repay.name + '</td>' +
	                        '<td>' + res.data[i].latefee + '</td>' +
	                        '<td>' + res.data[i].penalty + '</td>' +
	                        '<td>' + servicefees + '</td>' +
	                        '<td>' + state + '</td>' +
	                        '<td><div class="channel-table-alter" onclick="channelall.productread(' + res.data[i].id + ')">查看</div></td>' +
	                        '</tr>';
	                }
	                $('.product-table').append(btr);
	                $('.channel_height_two').css('minHeight', $(document).height() - 62);
	            },
	            error: function(res) {
	                var str = res.responseText;
	                var obj2 = eval("(" + str + ")");
	                if (obj2.message) {
	                    alert(obj2.message)
	                } else {
	                    alert(obj2.detail)
	                }　
	            }
	        });
	    });
	    //	-------------------------nav查询---------------------------
	    $('.order_selects').on('click', function() {
	        $('.orderSelect').show();
	        $('.ordercontent').html('');
	        $('.otherordertwo').html('');
	    });
	    $('.channel-header-click').eq(3).on('click', function() {
	        $('.channel_select .some_page').hide();
	        $('.selecttr').remove();
	        $('.seep-pages').html('');
	        $('.orderSelect').show();
	        $('.ordercontent').html('');
	        $('.otherordertwo').html('');
	        var state = $('.select-time select').val().toString();
	        $('#datepicker-5').val(now);
	        $('#datepicker-6').val(nowtwo);
	    });
	    $('.chaxun').on('click', function() {
	        $('.channel_select .some_page').show();
	        cstop = false;
	        channelall.orderlist(1);
	        astop = true;
	    })

	    $('.channel-content-click').on('click', function() {
	        $(this).addClass('nav_color').siblings('li').removeClass('nav_color');
	    });

	    //		----------------------个人中心--------------------------
	    $('.channel-content-click').eq(0).on('click', function() {
	        $('#channel-allcontent').load('html/personal.html', function() {
	            $('.channel_height').css('minHeight', $(document).height() - 62);
	            $('.channel-personal-bottom').css('minHeight', $(document).height() - 440);
	            channelall.personalCenter();
	        });
	    });
	    //		----------------------个人信息--------------------------
	    $('.channel-content-click').eq(1).on('click', function() {
	        $('#channel-allcontent').load('html/personalinfo.html', function() {
	            gotoindex();
	            $('.channel_height').css('minHeight', $(document).height() - 62);
	            $('.channel-swipers').css('minHeight', $(document).height() - 147);
	            $.ajax({
	                type: "get",
	                url: host + "/channel/channel_info/",
	                async: true,
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	                success: function(res) {
	                    console.log(res);
	                    $('.channel-personalinfo-1').find('input').eq(0).val(res.data.user.username);
	                    $('.channel-personalinfo-1').find('input').eq(1).val(res.data.user.realname);
	                    $('.channel-personalinfo-1').find('input').eq(2).val(res.data.user.email);
	                    $('.channel-personalinfo-1').find('input').eq(3).val(res.data.user.phone);
	                    $('.textarea-1').find('textarea').text(res.data.user.remark);
	                }
	            });
	        });
	    });
	    //		-----------------------渠道信息------------------------------
	    $('.channel-content-click').eq(2).on('click', function() {
	            $('#channel-allcontent').load('html/channelinfo.html', function() {
	                $('.channel_height').css('minHeight', $(document).height() - 62);
	                $('.channel-swipers').css('minHeight', $(document).height() - 147);
	                gotoindex();
	                $.ajax({
	                    type: "get",
	                    url: host + "/channel/channel_info/",
	                    async: true,
	                    contentType: "application/json; charset=utf-8",
	                    datatpye: 'json',
	                    beforeSend: function(request) {
	                        var channeltoken = $.cookie('channeltoken');
	                        request.setRequestHeader("authorization", channeltoken);
	                    },
	                    success: function(res) {
	                        console.log(res);
	                        $('.channelsinfo').find('input').eq(0).val(res.data.name);
	                        $('.channelsinfo').find('input').eq(1).val(res.data.address);
	                        $('.channelsinfo').find('input').eq(2).val(res.data.phone);
	                        $('.channelsinfo').find('input').eq(3).val(res.data.mobile);
	                        $('.channelsinfo').find('input').eq(4).val(res.data.manager);

	                        $('.channel-comment').find('textarea').eq(1).text(res.data.remark);
	                    }
	                });
	            });
	        })
	        //		------------------------操作员管理--------------------------------
	    $('.channel-content-click').eq(3).on('click', function() {
	            $('#channel-allcontent').load('html/channel-operator.html', function() {
	                $('.channel_height').css('minHeight', $(document).height() - 62);
	                $('.operator-padding').css('minHeight', $(document).height() - 147);
	                gotoindex();
	                $.ajax({
	                    type: "get",
	                    url: host + "/channel/userlist/",
	                    contentType: "application/json; charset=utf-8",
	                    datatpye: 'json',
	                    async: true,
	                    beforeSend: function(request) {
	                        var channeltoken = $.cookie('channeltoken');
	                        request.setRequestHeader("authorization", channeltoken);
	                    },
	                    success: function(res) {
	                        console.log(res.data);
	                        var lng = res.data.length;
	                        var btr = '';
	                        var state = null;
	                        var state_name = '';
	                        for (var i = 0; i < lng; i++) {
	                            if (res.data[i].state_code == 0) {
	                                state = 1;
	                                state_name = '启用';
	                            }
	                            if (res.data[i].state_code == 1) {
	                                state = 0;
	                                state_name = '停用';
	                            }
	                            btr += '<tr class="caozuo">' +
	                                '<td>' + res.data[i].username + '</td>' +
	                                '<td>' + res.data[i].realname + '</td>' +
	                                '<td>' + res.data[i].phone + '</td>' +
	                                '<td>' + res.data[i].email + '</td>' +
	                                '<td>' + res.data[i].remark + '</td>' +
	                                '<td>' + res.data[i].state + '</td>' +
	                                '<td><div class="channel-table-alter" onclick="peratorput(' + res.data[i].pk + ',this)">修改</div><div class="channel-table-remove" onclick="peratordelete(' + state + ',' + res.data[i].pk + ',this)">' + state_name + '</div></td>' +
	                                '</tr>';
	                        }
	                        $('.optable').append(btr);
	                    }
	                });
	                //			------------------------查询----------------------------
	                $('.perator-select').on('click', function() {

	                    var data = {
	                        "username": $('.channel-operator p').eq(0).find('input').val(),
	                        "phone": $('.channel-operator p').eq(2).find('input').val(),
	                        "realname": $('.channel-operator p').eq(1).find('input').val(),
	                    }
	                    console.log(data)
	                    $.ajax({
	                        type: "get",
	                        url: host + "/channel/handleuser/",
	                        contentType: "application/json; charset=utf-8",
	                        datatpye: 'json',
	                        data: data,
	                        async: true,
	                        beforeSend: function(request) {
	                            var channeltoken = $.cookie('channeltoken');
	                            request.setRequestHeader("authorization", channeltoken);
	                        },
	                        success: function(res) {
	                            console.log(res);
	                            $('.caozuo').remove();
	                            console.log(res.data);
	                            var lng = res.data.length;
	                            var btr = '';
	                            for (var i = 0; i < lng; i++) {
	                                btr += '<tr class="caozuo">' +
	                                    '<td>' + res.data[i].username + '</td>' +
	                                    '<td>' + res.data[i].realname + '</td>' +
	                                    '<td>' + res.data[i].phone + '</td>' +
	                                    '<td>' + res.data[i].email + '</td>' +
	                                    '<td>' + res.data[i].remark + '</td>' +
	                                    '<td>' + res.data[i].state + '</td>' +
	                                    '<td><div class="channel-table-alter" onclick="peratorput(' + res.data[i].pk + ',this)">修改</div><div class="channel-table-remove" onclick="peratordelete(' + res.data[i].pk + ',this)">删除</div></td>' +
	                                    '</tr>';
	                            }
	                            $('.optable').append(btr);

	                        },
	                        error: function(res) {
	                            var str = res.responseText;
	                            var obj2 = eval("(" + str + ")");
	                            if (obj2.message) {
	                                alert(obj2.message)
	                            } else {
	                                alert(obj2.detail)
	                            }　
	                        }
	                    });
	                });

	                //			新增用户
	                $('.perator-add').on('click', function() {
	                    $.ajax({
	                        type: "get",
	                        url: host + "/channel/init_form/",
	                        async: true,
	                        datatpye: 'json',
	                        data: {
	                            'module': 'channel'
	                        },
	                        contentType: "application/json; charset=utf-8",
	                        beforeSend: function(request) {
	                            var channeltoken = $.cookie('channeltoken');
	                            request.setRequestHeader("authorization", channeltoken);
	                        },
	                        success: function(res) {
	                            console.log(res);
	                            $('#channel-allcontent').load('html/channel-add.html', function() {
	                                $('.channel_height').height($(document).height() - 62);
	                                $('.operator-padding').height($(document).height() - 147);
	                                gotoindex();
	                                gotooperator();
	                                var bbtn = '';
	                                var data = res.data[0].permission;
	                                for (var i = 0; i < data.length; i++) {
	                                    bbtn += '<input type="button" value="' + data[i].name + '" id="' + data[i].code + '" class="channel-btn"/>';
	                                }
	                                $('.jurisdiction').append(bbtn);
	                                var bst = '';
	                                for (var i = 0; i < res.data[2].leaders.length; i++) {
	                                    bst += '<option value="' + res.data[2].leaders[i].pk + '">' + res.data[2].leaders[i].realname + '</option>'
	                                }
	                                $('#channelleader').append(bst);
	                                $('.resetpassword').hide();
	                                // $('.channel-btn').eq(5).css('margin-left', '72px');

	                                $('.channel-btn').each(function() {
	                                    var bstop = true;
	                                    $(this).on("click", function() {
	                                        if ($(this).css('color') == 'rgb(0, 0, 0)') {
	                                            bstop = true;
	                                        } else if ($(this).css('color') == 'rgb(255, 255, 255)') {
	                                            bstop = false;
	                                        }
	                                        if (bstop == true) {
	                                            $(this).css({
	                                                backgroundColor: '#FD7910',
	                                                color: 'white'
	                                            });
	                                            bstop = false;
	                                        } else {
	                                            $(this).css({
	                                                backgroundColor: 'white',
	                                                color: 'black'
	                                            });
	                                            bstop = true;
	                                        }
	                                    })
	                                });

	                                $('.add-tijiao input').eq(0).on('click', function() {
	                                    var name = $('#channelnameres').val();
	                                    var realname = $('#channelrealname').val();
	                                    var email = $('#channelemail').val();
	                                    var phone = $('#channelphone').val();
	                                    var leaders = $('#channelleader').val();
	                                    var phone_reg = /^1[3|4|5|7|8]\d{9}$/;
	                                    var codeall = [];
	                                    $('.channel-btn').each(function() {
	                                        if ($(this).css('color') == 'rgb(255, 255, 255)') {
	                                            codeall.push($(this).attr('id'));
	                                        }
	                                    });
	                                    var data = {
	                                        'username': name,
	                                        'realname': realname,
	                                        'email': email,
	                                        'phone': phone,
	                                        'codes': codeall,
	                                        'leader': leaders
	                                    };
	                                    console.log(data);

	                                    if (!phone_reg.test(phone)) {
	                                        alert('请输入正确的手机号');
	                                    } else if (name == '') {
	                                        alert('请输入用户名');
	                                    } else if (realname == '') {
	                                        alert('请输入姓名');
	                                    } else if (email == '') {
	                                        alert('请输入邮箱');
	                                    } else if (codeall == '') {
	                                        alert('请输入操作权限');
	                                    } else {
	                                        $.ajax({
	                                            type: "POST",
	                                            url: host + "/channel/handleuser/",
	                                            async: true,
	                                            data: JSON.stringify(data),
	                                            datatpye: 'json',
	                                            contentType: "application/json; charset=utf-8",
	                                            beforeSend: function(request) {
	                                                var channeltoken = $.cookie('channeltoken');
	                                                request.setRequestHeader("authorization", channeltoken);
	                                            },
	                                            success: function(res) {
	                                                console.log(res)
	                                                alert(res.message)
	                                                $('.channel-content-click').eq(3).click();
	                                            },
	                                            error: function(res) {
	                                                var str = res.responseText;
	                                                var obj2 = eval("(" + str + ")");
	                                                if (obj2.message) {
	                                                    alert(obj2.message)
	                                                } else {
	                                                    alert(obj2.detail)
	                                                }　
	                                            }
	                                        });
	                                    }

	                                });

	                                $('.add-tijiao input').eq(1).on('click', function() {
	                                    $('#reset-2').trigger('click');
	                                    $('.channel-btn').css({
	                                        backgroundColor: 'white',
	                                        color: 'black'
	                                    });
	                                });

	                            })
	                        },
	                        error: function(res) {
	                            var str = res.responseText;
	                            var obj2 = eval("(" + str + ")");
	                            if (obj2.message) {
	                                alert(obj2.message)
	                            } else {
	                                alert(obj2.detail)
	                            }　
	                        }

	                    });
	                });

	            });

	        })
	        //	-----------------------修改密码---------------------------
	    $('.channel-content-click').eq(4).on('click', function() {
	        $('#channel-allcontent').load('html/channel-change.html', function() {
	            gotoindex();
	            $('.channel_height').css('minHeight', $(document).height() - 62);
	            $('.channel-swipers').css('minHeight', $(document).height() - 147);
	            $('.channel-change').find('button').eq(0).on('click', function() {
	                var old_password = $('.channel-change').find('input').eq(0).val();
	                var new_password = $('.channel-change').find('input').eq(1).val();
	                var confirm_password = $('.channel-change').find('input').eq(2).val();
	                var data = {
	                    'old_password': old_password,
	                    'new_password': new_password,
	                    'confirm_password': confirm_password

	                }
	                $.ajax({
	                    type: "post",
	                    url: host + "/channel/password/",
	                    contentType: "application/json; charset=utf-8",
	                    async: true,
	                    datatpye: 'json',
	                    data: JSON.stringify(data),
	                    beforeSend: function(request) {
	                        var channeltoken = $.cookie('channeltoken');
	                        request.setRequestHeader("authorization", channeltoken);
	                    },
	                    success: function(res) {
	                        if (res.message) {
	                            alert(res.message)
	                        }
	                    },
	                    error: function(res) {
	                        var str = res.responseText;
	                        var obj2 = eval("(" + str + ")");
	                        if (obj2.message) {
	                            alert(obj2.message)
	                        } else {
	                            alert(obj2.detail)
	                        }　
	                    }
	                });
	            });
	            //				---------------------重置密码-----------------------------
	            $('.channel-change').find('button').eq(1).on('click', function() {
	                $('.channel-change').find('input').eq(0).val('');
	                $('.channel-change').find('input').eq(1).val('');
	                $('.channel-change').find('input').eq(2).val('');
	            })
	        });

	    });

	    //	   --------------------------------data-----------------------------
	    monthName("#datepicker");
	    monthName("#datepicker-2");
	    monthName("#datepicker-3");
	    monthName("#datepicker-4");
	    monthName("#datepicker-5");
	    monthName("#datepicker-6");
	    monthName("#datepicker-7");
	    monthName("#datepicker-8");
	    //	--------------------订单申请-----------------------------
	    $('.ask-next').eq(0).on('click', function() {
	        $(document).scrollTop(0);

	        var ddproduct = $('.prodect-1').val();
	        var ddusage = $('.useof').val();
	        var ddamout = $('.limit').val();
	        var ddterm = $('.returntime').val();
	        var ddname = $('.ordername').val();
	        var ddid_num = $('.cardnumber').val();
	        var ddphone = $('.obphone').val();
	        var ddremark = $('.remark').val();
	        var phone_reg = /^1[3|4|5|7|8]\d{9}$/;
	        var IDCard_reg = /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i;
	        var data = {
	            'customer_name': ddname,
	            'id_num': ddid_num,
	            'phone': ddphone,
	            'product': ddproduct,
	            'usage': ddusage,
	            'amount': ddamout,
	            'term': ddterm,
	            'remark': ddremark,
	             'reapply': 0
	        }
	        if (ddproduct == '') {
	            alert('请输入产品类型');
	        } else if (ddusage == '') {
	            alert('请输入贷款用途');
	        } else if (ddamout == '') {
	            alert('请输入贷款额度');
	        }else if (ddamout<10000) {
	            alert('申请金额有误');
	        } else if (ddterm == '') {
	            alert('请输入还款期限');
	        } else if (ddname == '') {
	            alert('请输入申请人姓名');
	        } else if (!IDCard_reg.test(ddid_num)) {
	            alert('请正确输入身份证号码');
	        } else if (!phone_reg.test(ddphone)) {
	            alert('请正确输入预留手机号');
	        } else {
	            $.ajax({
	                type: "POST",
	                url: host + "/channel/order_base_info/",
	                async: true,
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                data: JSON.stringify(data),
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	                success: function(res) {
	                    console.log(res);
	                    $('.zhezhao').show();
	                    $('.area').html('');
	                    $(" .area-2 option[value=' ']").attr("selected", "selected");
	                    $('.options-six').remove();
	                    $('.options-three').remove();
	                    $('#channel-perfct').load('html/perfect-information.html', function() {
	                        $('.channel-allow h2').html(res.message);
	                        $('.zhezhao').click(function() {
	                            $('#channel-perfct').html('');
	                        })
	                        if (res.status == 'false') {
	                            $('.popup-btn').hide();
	                            $('.popup h4').hide();
	                        }
	                        if (res.status == 'success') {
	                            //完善资料
	                            data.reapply=res.reapply;
	                            $('.popup-btn button').eq(0).on('click', function() {
	                                    $.ajax({
	                                        type: "post",
	                                        url: host + "/channel/conform_order_data/",
	                                        async: true,
	                                        data: JSON.stringify(data),
	                                        contentType: "application/json; charset=utf-8",
	                                        datatpye: 'json',
	                                        beforeSend: function(request) {
	                                            var channeltoken = $.cookie('channeltoken');
	                                            request.setRequestHeader("authorization", channeltoken);
	                                        },
	                                        success: function(res) {
	                                            alert('订单号为:' + res.data.order_num);
	                                            order_num = res.data.order_num;
	                                            $('.zhezhao').hide();
	                                            $('#reset').trigger('click');
	                                            $('.province-2 option').eq(0).text('');

	                                            $('.getall').remove();
	                                            channelall.channelGet('.gender', 'gender', 'id', 'data');
	                                            channelall.channelGet('.marital', 'merriage', 'id', 'data');
	                                            channelall.channelGet('.education', 'education', 'id', 'data');
	                                            channelall.channelGet('.province', 'province', 'code', 'data');
	                                            channelall.channelGet('.province-2', 'province', 'code', 'data');
	                                            channelall.channelGet('.home_type', 'home_type', 'id', 'data');

	                                            $('#channel-perfct').html('');
	                                            $('.channel-ask').eq(0).hide();
	                                            $('.channel-ask').eq(1).show();
	                                            $('.ask-logo-item p').eq(1).css({
	                                                backgroundColor: '#FD7910',
	                                            })
	                                            $('.ask-logo-item h3').eq(0).css({
	                                                backgroundColor: '#FD7910',
	                                            })
	                                            $('.ask-logo-item span').eq(1).css({
	                                                color: '#FD7910',
	                                            })
	                                        },
	                                        error: function(res) {
	                                            var str = res.responseText;
	                                            var obj2 = eval("(" + str + ")");
	                                            if (obj2.message) {
	                                                alert(obj2.message)
	                                            } else {
	                                                alert(obj2.detail)
	                                            }　
	                                        }
	                                    });

	                                })
	                                //创建新订单
	                            $('.popup-btn button').eq(1).on('click', function() {
	                                $.ajax({
	                                    type: "post",
	                                    url: host + "/channel/conform_order_data/",
	                                    async: true,
	                                    data: JSON.stringify(data),
	                                    contentType: "application/json; charset=utf-8",
	                                    datatpye: 'json',
	                                    beforeSend: function(request) {
	                                        var channeltoken = $.cookie('channeltoken');
	                                        request.setRequestHeader("authorization", channeltoken);
	                                    },
	                                    success: function(res) {
	                                        console.log(res)
	                                        alert('订单号为:' + res.data.order_num);
	                                        $('#reset').trigger('click')
	                                        $('#channel-perfct').html('');
	                                        $('.zhezhao').hide();
	                                    },
	                                    error: function(res) {
	                                        var str = res.responseText;
	                                        var obj2 = eval("(" + str + ")");
	                                        if (obj2.message) {
	                                            alert(obj2.message);
	                                        } else {
	                                            alert(obj2.detail);
	                                        }　
	                                    }
	                                });
	                            })
	                        }
	                    });
	                },
	                error: function(res) {
	                    var str = res.responseText;
	                    var obj2 = eval("(" + str + ")");
	                    if (obj2.message) {
	                        alert(obj2.message)
	                    } else {
	                        alert(obj2.detail)
	                    }　
	                }
	            });
	        }

	    });
	    $('.checkbtn').on('change', function() {
	        if ($(this).prop('checked')) {
	            $('.province-2 option').eq(0).text($('.province').find('option:selected').text());

	            $('.province-2').val($('.province').val());
	            $(" .cities-2 option[value='" + $('.cities').val() + "']").attr("selected", "selected");

	            $(" .area-2 option[value='" + $('.area').val() + "']").attr("selected", "selected");

	            $('.house_address').eq(0).val($('.home_address').eq(0).val())
	        }
	    });
	    //		--------------------订单第二步--------------------------

	    $('.ask-next').eq(1).on('click', function() {

	        var ddgender = $('.gender').val();
	        var ddemail = $('.ddemail').val();
	        var ddeducation = $('.education').val();
	        var home_phone = $('.home_phone').val();
	        var ddmarriage = $('.marital').val();
	        var home_address_num = $('.area').val();
	        var home_post_code = $('.home_post_code').val();
	        var home_address = $('.home_address').val();
	        var house_address_num = $('.area-2').val();
	        var house_address = $('.house_address').val();
	        var house_type = $('.home_type').val();
	        var data = {
	            'order_num': order_num,
	            'gender': ddgender,
	            'email': ddemail,
	            'marriage': ddmarriage,
	            'education': ddeducation,
	            'home_address_num': home_address_num,
	            'home_address': home_address,
	            'home_post_code': home_post_code,
	            'house_address_num': house_address_num,
	            'house_address': house_address,
	            'home_phone': home_phone,
	            'home_type': house_type,
	        };
	        if (ddgender == '' && ddemail == '' && ddeducation == '' && home_phone == '' && ddmarriage == '' && home_address_num == null && home_post_code == '' && home_address == '' && house_address_num == '' && house_address == '' && house_type == '') {
	            data = {
	                'order_num': order_num
	            };
	        }
	        $.ajax({
	            type: "post",
	            url: host + "/channel/order_other_info/",
	            async: true,
	            data: JSON.stringify(data),
	            contentType: "application/json; charset=utf-8",
	            datatpye: 'json',
	            beforeSend: function(request) {
	                var channeltoken = $.cookie('channeltoken');
	                request.setRequestHeader("authorization", channeltoken);
	            },
	            success: function(res) {
	                console.log(res);
	                $('.channel-ask').eq(1).hide();
	                $('.channel-ask').eq(2).show();
	                $('.ask-logo-item p').eq(2).css({
	                    backgroundColor: '#FD7910',
	                })
	                $('.ask-logo-item h3').eq(1).css({
	                    backgroundColor: '#FD7910',
	                })
	                $('.ask-logo-item span').eq(2).css({
	                    color: '#FD7910',
	                })
	                $(document).scrollTop(0);
	                $('.getall').remove();
	                channelall.channelGet('.employment_type', 'employment_type', 'id', 'data');
	                channelall.channelGet('.income_type', 'income_type', 'id', 'data');
	                channelall.channelGet('.job_type', 'job_type', 'id', 'data');
	                channelall.channelGet('.company_type', 'company_type', 'id', 'data');
	                channelall.channelGet('.province-3', 'province', 'code', 'data');

	            },
	            error: function(res) {
	                var str = res.responseText;
	                var obj2 = eval("(" + str + ")");
	                if (obj2.message) {
	                    alert(obj2.message)
	                } else {
	                    alert(obj2.detail)
	                }　
	            }
	        });

	    });
	    //		----------------申请第三步---------------------------
	    $('.ask-next').eq(2).on('click', function() {
	            channelall.channelGet('#relations', 'relation', 'id', 'data');
	            var company_name = $('.company_name').val();
	            var employment_type = $('.employment_type').val();
	            var company_depart = $('.company_depart').val();
	            var company_phone = $('.company_phone').val();
	            var company_post_code = $('.company_post_code').val();
	            var company_job = $('.company_job').val();
	            var company_address_num = $('.area-3').val();
	            var company_address = $('.company_address').val();
	            var month_income = $('.month_income').val();
	            var income_type = $('.income_type').val();
	            var join_time = $('.join_time').val();
	            var job_type = $('.job_type').val()
	            var job_type_other = $('.job_type_other').val();
	            var company_type_other = $('.company_type_other').val();
	            var company_type = $('.company_type').val();

	            var data = {
	                'order_num': order_num,
	                'company_name': company_name,
	                'employee_type': employment_type,
	                'company_depart': company_depart,
	                'company_phone': company_phone,
	                'company_post_code': company_post_code,
	                'company_job': company_job,
	                'company_address_num': company_address_num,
	                'company_address': company_address,
	                'month_income': month_income,
	                'income_type': income_type,
	                'join_time': join_time,
	                'job_type': job_type,
	                'job_type_other': job_type_other,
	                'company_type_other': company_type_other,
	                'company_type': company_type
	            }
	            if (company_name == '' && employment_type == '' && company_depart == '' && company_phone == '' && company_post_code == '' && company_job == '' && company_address_num == '' && company_address == '' && month_income == '' && income_type == '' && join_time == '' && job_type == '' && job_type_other == '' && company_type_other == '' && company_type == '') {
	                data = {
	                    'order_num': order_num
	                };
	            }
	            $.ajax({
	                type: "post",
	                url: host + "/channel/order_work_info/",
	                async: true,
	                data: JSON.stringify(data),
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	                success: function(res) {
	                    console.log(res);
	                    $('.getall').remove();
	                    $('.relation_list').remove()
	                    $('.channel-ask').eq(2).hide();
	                    $('.channel-ask').eq(3).show();

	                    $('.ask-logo-item p').eq(3).css({
	                        backgroundColor: '#FD7910',
	                    })
	                    $('.ask-logo-item h3').eq(2).css({
	                        backgroundColor: '#FD7910',
	                    })
	                    $('.ask-logo-item span').eq(3).css({
	                        color: '#FD7910',
	                    })
	                    $(document).scrollTop(0);
	                },
	                error: function(res) {
	                    var str = res.responseText;
	                    var obj2 = eval("(" + str + ")");
	                    if (obj2.message) {
	                        alert(obj2.message)
	                    } else {
	                        alert(obj2.detail)
	                    }　
	                }
	            });
	        })
	        //		---------------------申请第四步---------------------------
	    $('.ask-next').eq(3).on('click', function() {
	        channelall.relation_submit(order_num);
	        $(document).scrollTop(0);

	    })
	    $('.ask-next').eq(4).on('click', function() {
	        channelall.bank_submit(order_num);

	    });
	    $('.channel-content-click').eq(5).on('click', function() {
	        $('#reset').trigger('click');
	        $('#reset-3').trigger('click');
	        $('#reset-4').trigger('click');
	        $('#channel-allask').show();
	        $('.pending-orders').hide();
	        $('.otherorder').html('');
	        $('.channel-ask').eq(0).show().siblings('form').hide();
	        $('.ask-logo-item p').css('background-color', ' #B0B1B1');
	        $('.ask-logo-item h3').css('background-color', ' #B0B1B1');
	        $('.ask-logo-item span').css('color', '#58666E');
	        $('.ask-logo-item p').eq(0).css('background-color', ' #FD7910');
	        $('.ask-logo-item span').eq(0).css('color', ' #FD7910');

	    });
	    $('.channel-content-click').eq(6).on('click', function() {
	        $('#channel-allask').hide();
	        $('.pending-orders').show();
	    });
	    //         -----------------------待处理订单------------------------------
	    $('.orders').on('click', function() {
	        gotoorder();
	        $('.channel_height_three').css('minHeight', $(document).height() - 62);
	        $('#datepicker-3').val(now);
	        $('#datepicker-4').val(nowtwo);
	        $('.backorder').remove();
	        $('.orders-tr').remove();
	        $('.otherorder').html('');
	        $('.order-argument input').eq(0).val('');
	        $('.order-argument input').eq(1).val('');
	        $('.pending-orders .pending-orders-content').eq(0).show();
	        $('.pending-orders .order-detail').hide();
	        $('.orderPaging').html('');
	        $('.pending-orders .some_page').hide();
	        $('.padding-select').click();
	    });
	    // 订单删除
	    $(document).on('click', '.order_delete', function() {
	            orderNum = $(this).parents('tr').find('td').eq(1).text();
	            var that = $(this);
	            var result = confirm('是否删除该订单');
	            if (result == true) {
	                $.ajax({
	                        url: host + '/channel/submit_order/',
	                        type: 'delete',
	                        data: JSON.stringify({ 'order_num': orderNum }),
	                        contentType: "application/json; charset=utf-8",
	                        datatpye: 'json',
	                        beforeSend: function(request) {
	                            var channeltoken = $.cookie('channeltoken');
	                            request.setRequestHeader("authorization", channeltoken);
	                        },
	                    })
	                    .done(function(res) {
	                        console.log(res);
	                        alert('该订单已删除');
	                        that.parents('.orders-tr').remove();
	                    })
	            }

	        })
	        //		--------------------附件上传--------------------------------
	    $(document).on('click', '.fujian', function() {
	        channelall.fujian = this;
	        orderNum = $(this).parents('tr').find('td').eq(1).text();
	         $('.pending-orders').hide();
	        $(this).addClass('refreshf');
	        $('.otherorder').load('html/channel-uploading.html', function() {
	            gotoorder();
	            $('.gotoorderlist').on('click', function() {
	                $('.pending-orders').show();
	                $('.otherorder').html('');
	                $('.refreshf').css('color', '#999');
	            });
	            $.ajax({
	                type: "get",
	                url: host + "/channel/attached_files/",
	                async: true,
	                data: {
	                    'order_num': orderNum
	                },
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	                success: function(res) {
	                    console.log(res);
	                    var lli = '';
	                    for (var i = 0; i < res.data.length; i++) {
	                        var sss = "'" + res.data[i].path_name + "'";
	                        lli += '<li>' +
	                            '<p class="clearfix" style="position:relative;"><span>' + res.data[i].name + '</span><i>' + res.data[i].qty + '</i><input class="download" type="file" multiple="multiple" onchange="picdownload(this,' + orderNum + ',' + res.data[i].id + ')"/ ><button class="fj_uploading" style="right:20px;">上传</button><button class="fj_uploading" style="right:80px;z-index:2003;" onclick="picget(' + sss + ',' + res.data[i].id + ')">实拍</button></p><div class="progress_bar" style="display:none"><div class="progress_barinfo"></div></div><div class="homepic clearfix">'
	                        for (var j = 0; j < res.data[i].img.length; j++) {

	                            lli += '<h4>' +
	                                '<img src="' + imghost + res.data[i].img[j].thumbnail + '" alt="" />' +
	                                '<a href="javascript:;" class="picremove" onclick="picremove(' + res.data[i].img[j].id + ',this)">删除</a>' +
	                                '</h4>'

	                        }
	                        lli += '</div></li>';

	                    }
	                    $('.accessory ul').append(lli);
	                   
	                }
	            });
	        })
	    });
	    $(document).on('click', '.fujiantwo', function() {
	        orderNum = $(this).parents('tr').find('td').eq(1).text();
	        $(this).addClass('fujianbtn');
	        $('.otherordertwo').load('html/channel-uploading.html', function() {
	            $('.otherordertwo .goorder').addClass('goordertwo');
	            gotoselect();
	            $('.otherordertwo .goorder').html('查询');
	            $('.otherordertwo .gotoorderlist').html('订单查询');
	            $('.otherordertwo .fujianname').html('附件查看');
	            $('.gotoorderlist').on('click', function() {
	                $('.orderSelect').show();
	                $('.otherordertwo').html('');
	                $('.fujianbtn').css('color', '#999');
	            });
	            $.ajax({
	                type: "get",
	                url: host + "/channel/attached_files/",
	                data: {
	                    'order_num': orderNum
	                },
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	            }).done(function(res) {
	                console.log(res);
	                var lli = '';
	                for (var i = 0; i < res.data.length; i++) {
	                    lli += '<li>' +
	                        '<p class="clearfix"><span>' + res.data[i].name + '</span><i>' + res.data[i].qty + '</i></p><div class="homepic clearfix">'
	                    for (var j = 0; j < res.data[i].img.length; j++) {

	                        lli += '<h4>' +
	                            '<img src="' + imghost + res.data[i].img[j].thumbnail + '" alt="" /></h4>'

	                    }
	                    lli += '</div></li>';

	                }
	                $('.otherordertwo .accessory ul').append(lli);
	                $('.orderSelect').hide();
	            })

	        })

	    });
	    // ------------------------返回--------------------------------
	    $('.goorderlist').on('click', function() {
	        $('.pending-orders-content').eq(0).show();
	        $('.order-detail').hide();
	        $('.refresh').css('color', '#999');
	        $('.backorder').remove();
	    });



	    $(document).on('click', '.uporder', function() {
	        orderNum = $(this).parents('tr').find('td').eq(1).text();
	        var data = {
	            'order_num': orderNum
	        }
	        $.ajax({
	                url:host+ '/channel/check_files/',
	                type:'get',
	                data: data,
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },

	            })
	            .done(function(res) {
	                console.log(res);
	                  var mymessage = confirm('是否提交订单');
	                  if (mymessage == true) {
	            $.ajax({
	                type: "post",
	                url: host + "/channel/submit_order/",
	                async: true,
	                data: JSON.stringify(data),
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	                success: function(res) {
	                    console.log(res);
	                    if (res.message) {
	                        alert(res.message);
	                        $('.orders').click();
	                    }
	                },
	                error: function(res) {
	                    var str = res.responseText;
	                    var obj2 = eval("(" + str + ")");
	                    if (obj2.message) {
	                        alert(obj2.message)
	                    } else {
	                        alert(obj2.detail)
	                    }　
	                }
	            })
	        }
	            })
	            	.fail(function (res) {
	            		 var str = res.responseText;
	                        var obj2 = eval("(" + str + ")");
	                        if (obj2.message) {
	                            alert(obj2.message)
	                        } else {
	                            alert(obj2.detail)
	                        }　

	            	})

	      
	        
	    });

	    //	---------------------------详情---------------------------------
	    $(document).on('click', '.xiangqing', function() {
	        $(document).scrollTop(0);
	        gotoorder();
	        $('.backorder').remove();
	        $('.backorderlist').append('<i class="backorder"> &gt 订单详情</i>')
	        $(this).addClass('refresh');
	        $('.refresh').css('color', '#FD7910');
	        $('.privy').html('');
	        $('.bank_ul').html('');
	        $('.pending-orders-content').eq(0).hide();
	        $('.order-detail').show();
	        orderNum = $(this).parents('tr').find('td').eq(1).text();
	        $.ajax({
	            type: "get",
	            url: host + "/channel/pending_detail/" + orderNum + "/",
	            async: true,
	            contentType: "application/json; charset=utf-8",
	            datatpye: 'json',
	            beforeSend: function(request) {
	                var channeltoken = $.cookie('channeltoken');
	                request.setRequestHeader("authorization", channeltoken);
	            },
	            success: function(res) {
	                resall = res;
	                $('.toptable tr').eq(1).find('td').eq(0).text(res.data.id);
	                $('.toptable tr').eq(1).find('td').eq(1).text(res.data.order_num);
	                $('.toptable tr').eq(1).find('td').eq(2).text(res.data.name);
	                $('.toptable tr').eq(1).find('td').eq(3).text(res.data.created);
	                $('.toptable tr').eq(1).find('td').eq(4).text(res.data.product.name);
	                $('.toptable tr').eq(1).find('td').eq(5).text(res.data.product_type_name);
	                $('.toptable tr').eq(1).find('td').eq(6).text(res.data.amount);
	                $('.toptable tr').eq(1).find('td').eq(7).text(res.data.term);
	                $('.toptable tr').eq(1).find('td').eq(8).text(res.data.state.name);
	                $('.order-item-left').eq(0).find('p').eq(0).find('i').text(res.data.product.name);
	                $('.order-item-left').eq(0).find('p').eq(1).find('i').text(res.data.amount);
	                $('.order-item-left').eq(0).find('p').eq(2).find('i').text(res.data.repay_type_name);
	                $('.order-item-left').eq(0).find('p').eq(3).find('i').text(res.data.term);
	                $('.order-item-left').eq(0).find('p').eq(4).find('i').text(res.data.useage);
	                $('.order-item-right').eq(0).find('p').eq(0).find('i').text(res.data.customer_name);
	                $('.order-item-right').eq(0).find('p').eq(1).find('i').text(res.data.id_num);
	                $('.order-item-right').eq(0).find('p').eq(2).find('i').text(res.data.reg_num);
	                $('.order-item-right').eq(0).find('p').eq(3).find('i').text(res.data.remark);
	                $('.order-item-left').eq(1).find('p').eq(0).find('i').text(res.data.gender.name);
	                $('.order-item-left').eq(1).find('p').eq(1).find('i').text(res.data.email);
	                $('.order-item-left').eq(1).find('p').eq(2).find('i').text(res.data.marriage.name);
	                $('.order-item-left').eq(1).find('p').eq(3).find('i').text(res.data.home_post_code);
	                $('.order-item-left').eq(1).find('p').eq(4).find('i').text(res.data.home_type.name);
	                if (res.data.home_province != '' || res.data.home_city || res.data.home_area) {
	                    $('.order-item-right').eq(1).find('p').eq(0).find('i').text(res.data.home_province.name + res.data.home_city.name + res.data.home_area.name);
	                } else {
	                    $('.order-item-right').eq(1).find('p').eq(0).find('i').text('');
	                }

	                $('.order-item-right').eq(1).find('p').eq(1).find('i').text(res.data.home_address);
	                if (res.data.house_province != '' || res.data.house_city != '' || res.data.house_area != '') {
	                    $('.order-item-right').eq(1).find('p').eq(2).find('i').text(res.data.house_province.name + res.data.house_city.name + res.data.house_area.name);
	                } else {
	                    $('.order-item-right').eq(1).find('p').eq(2).find('i').text('');
	                }

	                $('.order-item-right').eq(1).find('p').eq(3).find('i').text(res.data.house_address);
	                $('.order-item-right').eq(1).find('p').eq(4).find('i').text(res.data.home_phone);
	                $('.order-item-left').eq(2).find('p').eq(0).find('i').text(res.data.company_name);
	                $('.order-item-left').eq(2).find('p').eq(1).find('i').text(res.data.employee_type.name);
	                $('.order-item-left').eq(2).find('p').eq(2).find('i').text(res.data.company_depart);
	                $('.order-item-left').eq(2).find('p').eq(3).find('i').text(res.data.company_phone);
	                $('.order-item-left').eq(2).find('p').eq(4).find('i').text(res.data.company_post_code);
	                $('.order-item-left').eq(2).find('p').eq(5).find('i').text(res.data.company_job);
	                if (res.data.company_province != '' || res.data.company_city != '' || res.data.company_area != '') {
	                    $('.order-item-left').eq(2).find('p').eq(6).find('i').text(res.data.company_province.name + res.data.company_city.name + res.data.company_area.name);
	                } else {
	                    $('.order-item-left').eq(2).find('p').eq(6).find('i').text('');
	                }

	                $('.order-item-left').eq(2).find('p').eq(7).find('i').text(res.data.company_address);
	                $('.order-item-right').eq(2).find('p').eq(0).find('i').text(res.data.month_income);
	                $('.order-item-right').eq(2).find('p').eq(1).find('i').text(res.data.income_type.name);
	                $('.order-item-right').eq(2).find('p').eq(2).find('i').text(res.data.join_time);
	                if (res.data.company_type_other == '') {
	                    $('.order-item-right').eq(2).find('p').eq(3).find('i').text(res.data.company_type.name);
	                } else {
	                    $('.order-item-right').eq(2).find('p').eq(3).find('i').text(res.data.company_type_other);
	                }
	                if (res.data.job_type_other == '') {
	                    $('.order-item-right').eq(2).find('p').eq(4).find('i').text(res.data.job_type.name);
	                } else {
	                    $('.order-item-right').eq(2).find('p').eq(4).find('i').text(res.data.job_type_other);
	                }
	                var bul = '';
	                for (var i = 0; i < res.data.customercontact.length; i++) {
	                    var clrelation = res.data.customercontact[i].relation;
	                    bul +=
	                        '<ul class="order-item-ul clearfix">' +
	                        '<li style="width: 180px;">关系：<i>' + res.data.relative_relation[clrelation] + '</i></li>' +
	                        '<li style="width: 310px;">姓名：<i>' + res.data.customercontact[i].name + '</i></li>' +
	                        '<li>手机号码：<i>' + res.data.customercontact[i].phone + '</i></li>' +
	                        '</ul>' +
	                        '<ul class="order-item-ul clearfix" style="border-bottom: 1px solid #F4F4F4;margin-right: 20px;">' +
	                        '<li style="width: 180px;">年龄：<i>' + res.data.customercontact[i].age + '</i></li>' +
	                        '<li style="width: 310px;">是否知晓：<i>' + res.data.customercontact[i].is_knows.name + '</i></li>' +
	                        '<li style="width: 400px;">工作单位：<i>' + res.data.customercontact[i].companyname + '</i></li>' +
	                        '</ul>';
	                }
	                $('.privy').append(bul);
	                var bul_two = '';
	                for (var i = 0; i < res.data.customerbank.length; i++) {
	                    bul_two += '<ul class="order-item-ul clearfix">' +
	                        '<li>银行卡号：<i>' + res.data.customerbank[i].account + '</i></li>' +
	                        '<li>所属银行：<i>' + res.data.customerbank[i].name + '</i></li>' +
	                        '<li>预留手机号：<i>' + res.data.customerbank[i].phone + '</i></li>' +
	                        '</ul>';
	                }
	                $('.bank_ul').append(bul_two);
	            }
	        });
	    });

	    //	---------------------------详情---------------------------------
	    $(document).on('click', '.xiangqingtwo', function() {
	        $('.zhezhao').hide();
	        $(document).scrollTop(0);
	        $(this).addClass('xiangqingbtn');
	        $('.cldetails .privy').html('');
	        $('.cldetails .bank_ul').html('');
	        orderNum = $(this).parents('tr').find('td').eq(1).text();
	        $('.ordercontent').load('html/ordercontent.html', function() {

	            gotoselect();
	            $.ajax({
	                type: "GET",
	                url: host + "/channel/order_state/",
	                data: {
	                    'order_num': orderNum
	                },
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	            }).done(function(res) {
	                console.log(res);
	                for (var i = 0; i < res.data.length; i++) {
	                    $('.order-detail .ask-logo-item').eq(i).find('span').html(res.data[i].name)
	                    if (res.data[i].state == 1) {
	                        $('.order-detail .ask-logo-item').eq(i).find('p').css('backgroundColor', '#FD7910');
	                        $('.order-detail .ask-logo-item').eq(i - 1).find('h3').css('backgroundColor', '#FD7910');
	                    }
	                }
	            })
	            $('.orderSelect').hide();
	            $('.goorderlisttwo').on('click', function() {
	                $('.orderSelect').show();
	                $('.ordercontent').html('');
	                $('.xiangqingbtn').css('color', '#999');
	            });
	            $.ajax({
	                type: "get",
	                url: host + "/channel/pending_detail/" + orderNum + "/",
	                async: true,
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	                success: function(res) {
	                    console.log(res.data);
	                    $('.cldetails .toptable tr').eq(1).find('td').eq(0).text(res.data.order_num);
	                    $('.cldetails .toptable tr').eq(1).find('td').eq(1).text(res.data.name);
	                    $('.cldetails .toptable tr').eq(1).find('td').eq(2).text(res.data.created);
	                    $('.cldetails .toptable tr').eq(1).find('td').eq(3).text(res.data.product.name);
	                    $('.cldetails .toptable tr').eq(1).find('td').eq(4).text(res.data.product_type_name);
	                    $('.cldetails .toptable tr').eq(1).find('td').eq(5).text(res.data.amount);
	                    $('.cldetails .toptable tr').eq(1).find('td').eq(6).text(res.data.term);
	                    $('.cldetails .toptable tr').eq(1).find('td').eq(7).text(res.data.state.name);
	                    $('.cldetails .order-item-left').eq(0).find('p').eq(0).find('i').text(res.data.product.name);
	                    $('.cldetails .order-item-left').eq(0).find('p').eq(1).find('i').text(res.data.amount);
	                    $('.cldetails .order-item-left').eq(0).find('p').eq(2).find('i').text(res.data.repay_type_name);
	                    $('.cldetails .order-item-left').eq(0).find('p').eq(3).find('i').text(res.data.term);
	                    $('.cldetails .order-item-left').eq(0).find('p').eq(4).find('i').text(res.data.useage);
	                    $('.cldetails .order-item-right').eq(0).find('p').eq(0).find('i').text(res.data.customer_name);
	                    $('.cldetails .order-item-right').eq(0).find('p').eq(1).find('i').text(res.data.id_num);
	                    $('.cldetails .order-item-right').eq(0).find('p').eq(2).find('i').text(res.data.reg_num);
	                    $('.cldetails .order-item-right').eq(0).find('p').eq(3).find('i').text(res.data.remark);
	                    $('.cldetails .order-item-left').eq(1).find('p').eq(0).find('i').text(res.data.gender.name);
	                    $('.cldetails .order-item-left').eq(1).find('p').eq(1).find('i').text(res.data.email);
	                    $('.cldetails .order-item-left').eq(1).find('p').eq(2).find('i').text(res.data.marriage.name);
	                    $('.cldetails .order-item-left').eq(1).find('p').eq(3).find('i').text(res.data.home_post_code);
	                    $('.cldetails .order-item-left').eq(1).find('p').eq(4).find('i').text(res.data.home_type.name);
	                    $('.cldetails .order-item-right').eq(1).find('p').eq(0).find('i').text(res.data.home_province.name + res.data.home_city.name + res.data.home_area.name);
	                    $('.cldetails .order-item-right').eq(1).find('p').eq(1).find('i').text(res.data.home_address);
	                    $('.cldetails .order-item-right').eq(1).find('p').eq(2).find('i').text(res.data.house_province.name + res.data.house_city.name + res.data.house_area.name);
	                    $('.cldetails .order-item-right').eq(1).find('p').eq(3).find('i').text(res.data.house_address);
	                    $('.cldetails .order-item-right').eq(1).find('p').eq(4).find('i').text(res.data.home_phone);
	                    $('.cldetails .order-item-left').eq(2).find('p').eq(0).find('i').text(res.data.company_name);
	                    $('.cldetails .order-item-left').eq(2).find('p').eq(1).find('i').text(res.data.employee_type.name);
	                    $('.cldetails .order-item-left').eq(2).find('p').eq(2).find('i').text(res.data.company_depart);
	                    $('.cldetails .order-item-left').eq(2).find('p').eq(3).find('i').text(res.data.company_phone);
	                    $('.cldetails .order-item-left').eq(2).find('p').eq(4).find('i').text(res.data.company_post_code);
	                    $('.cldetails .order-item-left').eq(2).find('p').eq(5).find('i').text(res.data.company_job);
	                    $('.cldetails .order-item-left').eq(2).find('p').eq(6).find('i').text(res.data.company_province.name + res.data.company_city.name + res.data.company_area.name);
	                    $('.cldetails .order-item-left').eq(2).find('p').eq(7).find('i').text(res.data.company_address);
	                    $('.cldetails .order-item-right').eq(2).find('p').eq(0).find('i').text(res.data.month_income);
	                    $('.cldetails .order-item-right').eq(2).find('p').eq(1).find('i').text(res.data.income_type.name);
	                    $('.cldetails .order-item-right').eq(2).find('p').eq(2).find('i').text(res.data.join_time);
	                    if (res.data.company_type_other == '') {
	                        $('.cldetails .order-item-right').eq(2).find('p').eq(3).find('i').text(res.data.company_type.name);
	                    } else {
	                        $('.cldetails .order-item-right').eq(2).find('p').eq(3).find('i').text(res.data.company_type_other);
	                    }
	                    if (res.data.job_type_other == '') {
	                        $('.cldetails .order-item-right').eq(2).find('p').eq(4).find('i').text(res.data.job_type.name);
	                    } else {
	                        $('.cldetails .order-item-right').eq(2).find('p').eq(4).find('i').text(res.data.job_type_other);
	                    }
	                    var bul = '';
	                    for (var i = 0; i < res.data.customercontact.length; i++) {
	                        var clrelation = res.data.customercontact[i].relation;
	                        bul +=
	                            '<ul class="order-item-ul clearfix">' +
	                            '<li style="width: 180px;">关系：<i>' + res.data.relative_relation[clrelation] + '</i></li>' +
	                            '<li style="width: 310px;">姓名：<i>' + res.data.customercontact[i].name + '</i></li>' +
	                            '<li>手机号码：<i>' + res.data.customercontact[i].phone + '</i></li>' +
	                            '</ul>' +
	                            '<ul class="order-item-ul clearfix" style="border-bottom: 1px solid #F4F4F4;margin-right: 20px;">' +
	                            '<li style="width: 180px;">年龄：<i>' + res.data.customercontact[i].age + '</i></li>' +
	                            '<li style="width: 310px;">是否知晓：<i>' + res.data.customercontact[i].is_knows.name + '</i></li>' +
	                            '<li style="width: 400px;">工作单位：<i>' + res.data.customercontact[i].companyname + '</i></li>' +
	                            '</ul>';
	                    }
	                    $('.cldetails .privy').append(bul);
	                    var bul_two = '';
	                    for (var i = 0; i < res.data.customerbank.length; i++) {
	                        bul_two += '<ul class="order-item-ul clearfix">' +
	                            '<li>银行卡号：<i>' + res.data.customerbank[i].account + '</i></li>' +
	                            '<li>所属银行：<i>' + res.data.customerbank[i].name + '</i></li>' +
	                            '<li>预留手机号：<i>' + res.data.customerbank[i].phone + '</i></li>' +
	                            '</ul>';
	                    }
	                    $('.cldetails .bank_ul').append(bul_two);
	                }
	            })


	        });
	    })



	    //------------------------订单详情----------------------------
	    $('.ask-change').eq(0).on('click', function() {
	        $('.zhezhao').show();
	        $('#channel-ask .contentss').load('html/change-5.html', function() {
	            productname('.prodect-1');
	            $('.poductss').on('change', function() {
	                var sval = $(this).val();
	                $.ajax({
	                    type: "get",
	                    url: host + "/channel/product_repay/",
	                    async: true,
	                    data: {
	                        "id": sval
	                    },
	                    contentType: "application/json; charset=utf-8",
	                    datatpye: 'json',
	                    beforeSend: function(request) {
	                        var channeltoken = $.cookie('channeltoken');
	                        request.setRequestHeader("authorization", channeltoken);
	                    },
	                    success: function(res) {
	                        $('.returntype').val(res.data.name)
	                    },
	                    error: function(res) {
	                        var str = res.responseText;
	                        var obj2 = eval("(" + str + ")");
	                        if (obj2.message) {
	                            alert(obj2.message)
	                        } else {
	                            alert(obj2.detail)
	                        }　
	                    }
	                });

	            });
	            $(" .change_one .prodect-1 option[value='" + resall.data.product.id + "']").attr("selected", "selected");

	            $('.useof').eq(1).val(resall.data.useage);
	            $('.limit').eq(1).val(resall.data.amount);
	            $('.ordername').eq(1).val(resall.data.name);
	            $('.returntype').eq(1).val(resall.data.repay_type_name);
	            $('.cardnumber').eq(1).val(resall.data.id_num);
	            $('.obphone').eq(1).val(resall.data.reg_num);
	            $('.returntime').eq(1).val(resall.data.term);
	            $('.remark').eq(1).val(resall.data.remark);
	            $('.submits').on('click', function() {

	                var ddproduct = $('.change_one .prodect-1').val();
	                var ddusage = $('.change_one .useof').val();
	                var ddamout = $('.change_one .limit').val();
	                var ddterm = $('.change_one .returntime').val();
	                var ddname = $('.change_one .ordername').val();
	                var ddid_num = $('.change_one .cardnumber').val();
	                var ddphone = $('.change_one .obphone').val();
	                var ddremark = $('.change_one .remark').val();
	                var phone_reg = /^1[3|4|5|7|8]\d{9}$/;
	                var IDCard_reg = /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i;
	                var data = {
	                    'order_num': orderNum,
	                    'customer_name': ddname,
	                    'id_num': ddid_num,
	                    'phone': ddphone,
	                    'product': ddproduct,
	                    'useage': ddusage,
	                    'amount': ddamout,
	                    'term': ddterm,
	                    'remark': ddremark
	                }
	                if (ddproduct == '') {
	                    alert('请输入产品类型');
	                } else if (ddusage == '') {
	                    alert('请输入贷款用途');
	                } else if (ddamout == '') {
	                    alert('请输入贷款额度');
	                } else if (ddterm == '') {
	                    alert('请输入还款期限');
	                } else if (ddname == '') {
	                    alert('请输入申请人姓名');
	                } else if (!IDCard_reg.test(ddid_num)) {
	                    alert('请正确输入身份证号码');
	                } else if (!phone_reg.test(ddphone)) {
	                    alert('请正确输入预留手机号');
	                } else {
	                    $.ajax({
	                        type: "POST",
	                        url: host + "/channel/order_base_info/",
	                        async: true,
	                        contentType: "application/json; charset=utf-8",
	                        datatpye: 'json',
	                        data: JSON.stringify(data),
	                        beforeSend: function(request) {
	                            var channeltoken = $.cookie('channeltoken');
	                            request.setRequestHeader("authorization", channeltoken);
	                        },
	                        success: function(res) {
	                            console.log(res);
	                            $('.zhezhao').hide();
	                            $('.contentss').html('');
	                            $('.refresh').click();
	                        },
	                        error: function(res) {
	                            var str = res.responseText;
	                            var obj2 = eval("(" + str + ")");
	                            if (obj2.message) {
	                                alert(obj2.message)
	                            } else {
	                                alert(obj2.detail)
	                            }　
	                        }
	                    })
	                }

	            });

	        });
	        $(document).scrollTop(0);
	    });

	    //						--------------修改个人信息-----------------
	    $('.ask-change').eq(1).on('click', function() {
	        $('.zhezhao').show();
	        $('#channel-ask .contentss').load('html/change-personal.html', function() {
	            channelall.channelGet('.gendertwo', 'gender', 'id', 'data');
	            channelall.channelGet('.maritaltwo', 'merriage', 'id', 'data');
	            channelall.channelGet('.educationtwo', 'education', 'id', 'data');
	            channelall.channelGet('.province2', 'province', 'code', 'data');
	            channelall.channelGet('.province2-2', 'province', 'code', 'data');
	            channelall.channelGet('.home_typetwo', 'home_type', 'id', 'data');
	            channelall.getCities(resall.data.home_province.code);
	            channelall.citiesType(channelall.city, '.cities2');
	            channelall.getArea(resall.data.home_city.code);
	            channelall.citiesType(channelall.area, '.area2');
	            channelall.getCities(resall.data.house_province.code);
	            channelall.citiesTypeTwo(channelall.city, '.cities2-2');
	            channelall.getArea(resall.data.house_city.code);
	            channelall.citiesTypeTwo(channelall.area, '.area2-2');
	            $(" .gendertwo option[value='" + resall.data.gender.id + "']").attr("selected", "selected");
	            $(" .maritaltwo option[value='" + resall.data.marriage.id + "']").attr("selected", "selected");
	            $(" .home_typetwo option[value='" + resall.data.home_type.id + "']").attr("selected", "selected");
	            $(" .province2 option[value='" + resall.data.home_province.code + "']").attr("selected", "selected");
	            $(" .province2-2 option[value='" + resall.data.house_province.code + "']").attr("selected", "selected");
	            $(" .educationtwo option[value='" + resall.data.education.id + "']").attr("selected", "selected");

	            $(" .cities2 option[value='" + resall.data.home_city.code + "']").attr("selected", "selected");
	            $(" .area2 option[value='" + resall.data.home_area.code + "']").attr("selected", "selected");
	            $(" .cities2-2 option[value='" + resall.data.house_city.code + "']").attr("selected", "selected");
	            $(" .area2-2 option[value='" + resall.data.house_area.code + "']").attr("selected", "selected");

	            $('.home_post_code').eq(1).val(resall.data.home_post_code);
	            $('.home_address').eq(1).val(resall.data.home_address);
	            $('.house_address').eq(1).val(resall.data.house_address);
	            $('.ddemail').eq(1).val(resall.data.email);
	            $('.cardnumber').eq(1).val(resall.data.home_post_code);
	            $('.home_phone').eq(1).val(resall.data.home_phone);

	            $('.submits_two').on('click', function() {
	                var ddgender = $('.change_two .gendertwo').val();
	                var ddemail = $('.change_two .ddemail').val();
	                var ddeducation = $('.change_two .educationtwo').val();
	                var home_phone = $('.change_two .home_phone').val();
	                var ddmarriage = $('.change_two .maritaltwo').val();
	                var home_address_num = $('.change_two .area2').val();
	                var home_post_code = $('.change_two .home_post_code').val();
	                var home_address = $('.change_two .home_address').val();
	                var house_address_num = $('.change_two .area2-2').val();
	                var house_address = $('.change_two .house_address').val();
	                var house_type = $('.change_two .home_typetwo').val();
	                var data = {
	                    'order_num': orderNum,
	                    'gender': ddgender,
	                    'email': ddemail,
	                    'marriage': ddmarriage,
	                    'education': ddeducation,
	                    'home_address_num': home_address_num,
	                    'home_address': home_address,
	                    'home_post_code': home_post_code,
	                    'house_address_num': house_address_num,
	                    'house_address': house_address,
	                    'home_phone': home_phone,
	                    'home_type': house_type,
	                }
	                $.ajax({
	                    type: "post",
	                    url: host + "/channel/order_other_info/",
	                    async: true,
	                    data: JSON.stringify(data),
	                    contentType: "application/json; charset=utf-8",
	                    datatpye: 'json',
	                    beforeSend: function(request) {
	                        var channeltoken = $.cookie('channeltoken');
	                        request.setRequestHeader("authorization", channeltoken);
	                    },
	                    success: function(res) {
	                        console.log(res);
	                        $('.zhezhao').hide();
	                        $('.contentss').html('');
	                        $('.refresh').click();
	                    },
	                    error: function(res) {
	                        var str = res.responseText;
	                        var obj2 = eval("(" + str + ")");
	                        if (obj2.message) {
	                            alert(obj2.message)
	                        } else {
	                            alert(obj2.detail)
	                        }　
	                    }
	                });
	            });

	            $('.province2').change(function() {
	                $('.options-two').remove();
	                var code = $('.province2').val();
	                channelall.codecitytwo = code;
	                channelall.getCities(code);
	                channelall.citiesType(channelall.city, '.cities2');

	            });
	            $('.province2-2').focus(function() {
	                $('.province2-2 option').eq(0).text('');
	            });
	            $('.cities2-2').focus(function() {
	                $('.cities2-2 option').eq(0).text('');
	            });
	            $('.area2-2').focus(function() {
	                $('.area2-2 option').eq(0).text('');
	            });
	            $('.province2-2').change(function() {
	                $('.cities2-2 option').eq(0).text('');
	                $('.options-three').remove();
	                var code = $('.province2-2').val();
	                channelall.getCities(code);
	                channelall.citiesTypeTwo(channelall.city, '.cities2-2');

	            });
	            $('.cities2').change(function() {
	                $('.area2').html('');
	                var code = $('.cities2').val();
	                channelall.codeareatwo = code;
	                channelall.getArea(code);
	                channelall.citiesType(channelall.area, '.area2');
	            });
	            $('.cities2-2').change(function() {
	                $('.area2-2').html('<option value=""></option>');
	                var code = $('.cities2-2').val();
	                channelall.getArea(code);
	                channelall.citiesTypeTwo(channelall.area, '.area2-2');
	            });
	            $('.zhezhao').click(function() {
	                $(this).hide();
	                $('.contentss').html('');
	            });
	            //是否有房产
	            $('.change_two .ishavehome').on('change', function() {
	                if ($(this).val() == 0) {
	                    $('.change_two .checkbtn').show();
	                    $('.change_two .houseaddress').show();
	                    $('.change_two .house_address').parent().show();
	                    $('.change_two .samehouse').show();

	                }
	                if ($(this).val() == 1) {
	                    $('.change_two .checkbtn').hide();
	                    $('.change_two .houseaddress').hide();
	                    $('.change_two .house_address').parent().hide();
	                    $('.change_two .samehouse').hide();
	                }
	            })
	            $('.change_two .checkbtn').on('change', function() {
	                if ($(this).prop('checked')) {
	                    $('.cities2-2').html('<option value=""></option>');
	                    $('.area2-2').html('<option value=""></option>');
	                    channelall.getCities(channelall.codecitytwo);
	                    channelall.citiesTypeTwo(channelall.city, '.cities2-2');
	                    channelall.getCities(channelall.codeareatwotwo);
	                    channelall.citiesTypeTwo(channelall.area, '.area2-2');
	                    $('.province2-2 option').eq(0).text($('.province2').find('option:selected').text());

	                    $('.province2-2').val($('.province2').val());
	                    $(" .cities2-2 option[value='" + $('.cities2').val() + "']").attr("selected", "selected");
	                    $(" .area2-2 option[value='" + $('.area2').val() + "']").attr("selected", "selected");

	                    $('.house_address').eq(1).val($('.home_address').eq(1).val())
	                }
	            });
	        });
	    });

	    //					-----------------修改第三步----------------------------
	    $('.ask-change').eq(2).on('click', function() {
	        $('.zhezhao').show();

	        $('#channel-ask .contentss').load('html/change-2.html', function() {
	            $(document).scrollTop(0);
	            $("#myID-2").flatpickr();
	            $('.change_three .job_typetwo').on('change', function() {
	                if ($(this).val() == 13) {
	                    $('.change_three .job_type_other').removeAttr('disabled');
	                } else {
	                    $('.change_three .job_type_other').attr('disabled', 'disabled');
	                    $('.change_three .job_type_other').val('')
	                }
	            });
	            $('.change_three .company_typetwo').on('change', function() {
	                if ($(this).val() == 6) {
	                    $('.change_three .company_type_other').removeAttr('disabled');
	                } else {
	                    $('.change_three .company_type_other').attr('disabled', 'disabled');
	                    $('.change_three .company_type_other').val('')
	                }
	            });
	            channelall.getCities(resall.data.company_province.code);
	            channelall.citiesTypethree(channelall.city, '.cities-4');
	            channelall.getArea(resall.data.company_city.code);
	            channelall.citiesTypethree(channelall.area, '.area-4');
	            channelall.channelGet('.employment_typetwo', 'employment_type', 'id', 'data');
	            channelall.channelGet('.income_typetwo', 'income_type', 'id', 'data');
	            channelall.channelGet('.job_typetwo', 'job_type', 'id', 'data');
	            channelall.channelGet('.company_typetwo', 'company_type', 'id', 'data');
	            channelall.channelGet('.province-4', 'province', 'code', 'data');
	            $(" .employment_typetwo option[value='" + resall.data.employee_type.id + "']").attr("selected", "selected");
	            $(" .job_typetwo option[value='" + resall.data.job_type.id + "']").attr("selected", "selected");
	            $(" .income_typetwo option[value='" + resall.data.income_type.id + "']").attr("selected", "selected");
	            $(" .company_typetwo option[value='" + resall.data.company_type.id + "']").attr("selected", "selected");
	            $(" .province-4 option[value='" + resall.data.company_province.code + "']").attr("selected", "selected");
	            $(" .cities-4 option[value='" + resall.data.company_city.code + "']").attr("selected", "selected");
	            $(" .area-4 option[value='" + resall.data.company_area.code + "']").attr("selected", "selected");
	            $('.company_name').eq(1).val(resall.data.company_name);
	            $('.company_depart').eq(1).val(resall.data.company_depart);
	            $('.company_phone').eq(1).val(resall.data.company_phone);
	            $('.company_post_code').eq(1).val(resall.data.company_post_code);
	            $('.company_job').eq(1).val(resall.data.company_job);
	            $('.month_income').eq(1).val(resall.data.month_income);
	            $('.join_time').eq(1).val(resall.data.join_time);
	            $('.job_type_other').eq(1).val(resall.data.job_type_other);
	            $('.company_type_other').eq(1).val(resall.data.company_type_other);
	            $('.change_three .company_address').val(resall.data.company_address);
	            if ($('.change_three .job_typetwo').val() == 13) {
	                $('.change_three .job_type_other').removeAttr('disabled');
	            } else {
	                $('.change_three .job_type_other').attr('disabled', 'disabled');
	                $('.change_three .job_type_other').val('')
	            };
	            if ($('.change_three .company_typetwo').val() == 6) {
	                $('.change_three .company_type_other').removeAttr('disabled');
	            } else {
	                $('.change_three .company_type_other').attr('disabled', 'disabled');
	                $('.change_three .job_type_other').val('')
	            }
	            $('.submits_three').on('click', function() {
	                var company_name = $('.change_three .company_name').val();
	                var employment_type = $('.change_three .employment_typetwo').val();
	                var company_depart = $('.change_three .company_depart').val();
	                var company_phone = $('.change_three .company_phone').val();
	                var company_post_code = $('.change_three .company_post_code').val();
	                var company_job = $('.change_three .company_job').val();
	                var company_address_num = $('.change_three .area-4').val();
	                var company_address = $('.change_three .company_address').val();
	                var month_income = $('.change_three .month_income').val();
	                var income_type = $('.change_three .income_typetwo').val();
	                var join_time = $('.change_three .join_time').val();
	                var job_type = $('.change_three .job_typetwo').val()
	                var job_type_other = $('.change_three .job_type_other').val();
	                var company_type = $('.change_three .company_typetwo').val();
	                var company_type_other = $('.change_three .company_type_other').val();

	                var data = {
	                    'order_num': orderNum,
	                    'company_name': company_name,
	                    'employee_type': employment_type,
	                    'company_depart': company_depart,
	                    'company_phone': company_phone,
	                    'company_post_code': company_post_code,
	                    'company_job': company_job,
	                    'company_address_num': company_address_num,
	                    'company_address': company_address,
	                    'month_income': month_income,
	                    'income_type': income_type,
	                    'join_time': join_time,
	                    'job_type': job_type,
	                    'job_type_other': job_type_other,
	                    'company_type': company_type,
	                    'company_type_other': company_type_other,
	                }
	                $.ajax({
	                    type: "post",
	                    url: host + "/channel/order_work_info/",
	                    async: true,
	                    data: JSON.stringify(data),
	                    contentType: "application/json; charset=utf-8",
	                    datatpye: 'json',
	                    beforeSend: function(request) {
	                        var channeltoken = $.cookie('channeltoken');
	                        request.setRequestHeader("authorization", channeltoken);
	                    },
	                    success: function(res) {
	                        console.log(res);

	                        $('.zhezhao').hide();
	                        $('.contentss').html('');
	                        $('.refresh').click();

	                    },
	                    error: function(res) {
	                        var str = res.responseText;
	                        var obj2 = eval("(" + str + ")");
	                        if (obj2.message) {
	                            alert(obj2.message)
	                        } else {
	                            alert(obj2.detail)
	                        }　
	                    }
	                });
	            })

	            $('.province-4').change(function() {
	                $('.options-four').remove();
	                var code = $('.province-4').val();
	                channelall.getCities(code);
	                channelall.citiesTypethree(channelall.city, '.cities-4');

	            });
	            $('.cities-4').change(function() {
	                $('.area-four').html('');
	                var code = $('.cities-4').val();
	                channelall.getArea(code);
	                channelall.citiesTypethree(channelall.area, '.area-4');
	            });

	            $('.zhezhao').click(function() {
	                $(this).hide();
	                $('.contentss').html('');
	            });
	        });
	    });

	    //					-------------修改第四步------------------------
	    $('.ask-change').eq(3).on('click', function() {
	        $('.zhezhao').show();
	        $('#channel-ask .contentss').load('html/change-3.html', function() {
	            var ltr = '';
	            for (var i = 0; i < resall.data.customercontact.length; i++) {
	                ltr += '<tr class="relation_list">' +
	                    '<td>' +
	                    '<select name="" class="relations' + i + '" id="relations" style="width: 80px;height: 20px;">' +
	                    '<option value=""></option>' +
	                    '</select>' +
	                    '</td>' +
	                    '<td><input type="text" sid="' + resall.data.customercontact[i].id + '" id="relation_name" style="width: 80px;text-align: center;" value="' + resall.data.customercontact[i].name + '" /></td>' +
	                    '<td><input type="text" id="relation_phone" maxlength="11" style="width: 100px;text-align: center;" value=' + resall.data.customercontact[i].phone + '  /></td>' +
	                    '<td><input type="text" id="relation_age" style="width: 20px; text-align: center;" value="' + resall.data.customercontact[i].age + '"  /></td>' +
	                    '<td><input type="text" id="relation_companyname" style="text-align: center;" value="' + resall.data.customercontact[i].companyname + '"  /></td>' +
	                    '<td>' +
	                    '<select name="" id="relation_know_loan" class="relation_know_loan' + i + '" style="width: 50px;height: 20px;">' +
	                    '<option value="1">是</option>' +
	                    '<option value="0">否</option>' +
	                    '</select>' +
	                    '</td>' +
	                    '<td>' +
	                    '<div class="channel-table-alter" onclick="channelall.confirm_relations(this)" style="margin-bottom: 0;">确认</div>' +
	                    '</td>' +
	                    '</tr>';

	            }
	            setTimeout(function() {
	                for (var i = 0; i < resall.data.customercontact.length; i++) {
	                    channelall.channelGet('.relations' + i + '', 'relation', 'id', 'data');
	                    $(" .relations" + i + " option[value='" + resall.data.customercontact[i].relation + "']").attr("selected", "selected");
	                    $(" .relation_know_loan" + i + " option[value='" + resall.data.customercontact[i].is_knows.id + "']").attr("selected", "selected");
	                }
	            }, 300)

	            $('.addpersonal').parent().before(ltr);

	            $('.submits_four').on('click', function() {

	                channelall.relation_submit(orderNum);
	                $('.zhezhao').hide();
	                $('.contentss').html('');
	                setTimeout(function() {
	                    $('.refresh').click();
	                }, 300)
	            });

	            $('.zhezhao').click(function() {
	                $(this).hide();
	                $('.contentss').html('');

	            });
	        });
	        $(document).scrollTop(0);
	    })

	    //					----------------修改最后一步---------------------
	    $('.ask-change').eq(4).on('click', function() {
	        $('.zhezhao').show();
	        $('#channel-ask .contentss').load('html/change-4.html', function() {
	            var ktr = '';
	            for (var i = 0; i < resall.data.customerbank.length; i++) {
	                ktr += '<tr class="bank_list">' +
	                    '<td><span class="default_bank" is_know="0">(默)</span><input type="text" id="bank_account" style="width:180px;text-align: center;" value=' + resall.data.customerbank[i].account + '  /></td>' +
	                    '<td><input type="text" id="bank_name" maxlength="11" style="width: 180px;text-align: center;" value=' + resall.data.customerbank[i].name + '   /></td>' +
	                    '<td><input type="text" id="bank_phone" maxlength="11" style="width: 120px;text-align: center;" value=' + resall.data.customerbank[i].phone + '  /></td>' +
	                    '<td>' +
	                    '<div class="channel-table-alter" onclick="channelall.confirm_banks(this)" style="margin-bottom: 0;">确认</div>' +
	                    '</td>' +
	                    '</tr>';
	            }
	            $('.bankcard').parent().before(ktr);
	            $('.submits_last').on('click', function() {
	                channelall.bank_submittwo(orderNum);
	                $('.zhezhao').hide();
	                $('.contentss').html('');
	                setTimeout(function() {
	                    $('.refresh').click();
	                }, 300)
	            });
	            $('.zhezhao').click(function() {
	                $(this).hide();
	                $('.contentss').html('');
	            });
	        });
	        $(document).scrollTop(0);
	    })

	})
	$('.zhezhao').click(function() {
	    $(this).hide();
	    $('.contentss').html('');
	});
	//-------------------产品名称-----------------------------
	function productname(product) {
	    $('.options').remove();
	    if (channelall.data.product) {
	        var len = channelall.data.product.length;
	        var opa = '';
	        for (var i = 0; i < len; i++) {
	            opa += '<option value="' + channelall.data.product[i].id + '" class="options">' + channelall.data.product[i].name + '</option>'
	        }
	        $(product).append(opa);
	    }

	}

	var channelall = { // 渠道对象
	        data: '',
	        selectProvince: function() { //获取城市ajax
	            $.ajax({
	                type: "get",
	                url: host + "/channel/getoptions/",
	                async: false,
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	                success: function(res) {
	                    channelall.data = res.data;
	                }

	            });
	        },
	        getCities: function(code) { // 获取城省市
	            $.ajax({
	                type: "get",
	                url: host + "/common/city_list/",
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                async: false,
	                data: {
	                    "province": code
	                },
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	                success: function(res) {
	                    channelall.city = res;
	                }

	            });
	        },
	        getArea: function(code) { //获取地区
	            $.ajax({
	                type: "get",
	                async: false,
	                url: host + "/common/area_list/",
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                data: {
	                    "city": code
	                },
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	                success: function(res) {
	                    channelall.area = res;
	                }

	            });
	        },
	        channelGet: function(product, type, id, data) { //下拉内容

	            var len = channelall[data][type].length;
	            var opa = '';
	            for (var i = 0; i < len; i++) {
	                opa += '<option class="getall" value="' + channelall[data][type][i][id] + '">' + channelall[data][type][i].name + '</option>'
	            }
	            $(product).append(opa);
	        },
	        citiesType: function(city, product) {
	            var len = city.length;
	            var opa = '';
	            for (var i = 0; i < len; i++) {
	                opa += '<option value="' + city[i].code + '" class="options-two">' + city[i].name + '</option>'
	            }
	            $(product).append(opa);
	        },
	        citiesTypeTwo: function(city, product) {
	            var len = city.length;
	            var opa = '';
	            for (var i = 0; i < len; i++) {
	                opa += '<option value="' + city[i].code + '" class="options-three">' + city[i].name + '</option>'
	            }
	            $(product).append(opa);
	        },
	        citiesTypethree: function(city, product) {
	            var len = city.length;
	            var opa = '';
	            for (var i = 0; i < len; i++) {
	                opa += '<option value="' + city[i].code + '" class="options-four">' + city[i].name + '</option>'
	            }
	            $(product).append(opa);
	        },
	        citiesTypefour: function(city, product) {
	            var len = city.length;
	            var opa = '';
	            for (var i = 0; i < len; i++) {
	                opa += '<option value="' + city[i].code + '" class="options-five">' + city[i].name + '</option>'
	            }
	            $(product).append(opa);
	        },
	        citiesTypefive: function(city, product) {
	            var len = city.length;
	            var opa = '';
	            for (var i = 0; i < len; i++) {
	                opa += '<option value="' + city[i].code + '" class="options-six">' + city[i].name + '</option>'
	            }
	            $(product).append(opa);
	        },
	        personalCenter: function() { //个人中心
	            monthName('#datepicker');
	            monthName('#datepicker-2');
	            $('#datepicker').val(now);
	            $('#datepicker-2').val(nowtwo);
	            $(function() {
	                var time_limit = 30;
	                channelall.getday(time_limit, 0);
	            })
	            $('.channel-per-day a').on('click', function() {
	                $(this).css({
	                    backgroundColor: '#FD7910',
	                    borderColor: '#E16B0D',
	                    color: 'white'
	                }).siblings('a').css({
	                    backgroundColor: 'white',
	                    borderColor: '#EBEBEB',
	                    color: 'black'
	                })
	            });
	            $('.channel-per-day a').eq(0).on('click', function() {
	                time_limit = 1;
	                channelall.getday(time_limit, 0);
	            });
	            $('.channel-per-day a').eq(1).on('click', function() {
	                time_limit = 7;
	                channelall.getday(time_limit, 0);
	            });
	            $('.channel-per-day a').eq(2).on('click', function() {
	                time_limit = 30;
	                channelall.getday(time_limit, 0);
	            });
	            $('.chanel-personal-data-3 button').on('click', function() {
	                var start_time = $('#datepicker').val();
	                var end_time = $('#datepicker-2').val();
	                channelall.getday(1, 1, start_time, end_time);
	            });

	        },
	        getday: function(time_limit, query, start_time, end_time) { //获取日期
	            var data = {
	                'time_limit': time_limit,
	                'query': query,
	                'start_time': start_time,
	                'end_time': end_time
	            }
	            $.ajax({
	                type: "get",
	                url: host + "/channel/personal/",
	                async: true,
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                data: data,
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	                success: function(res) {
	                    console.log(res)
	                    $('.channel-personal-circle').eq(0).html(res.data.today[0]);
	                    $('.channel-personal-circle').eq(1).html(res.data.this_month);
	                    $('.channel-personal-circle').eq(2).html(res.data.wait_review);
	                    var dtime = [];
	                    var sign = [];
	                    var dpass = [];
	                    if (res.data.count == '') {
	                        var myDate = new Date();
	                        //获取当前年
	                        var year = myDate.getFullYear();
	                        //获取当前月
	                        var month = myDate.getMonth() + 1;
	                        //获取当前日
	                        var date = myDate.getDate();
	                        now_a = year + '-' + p(month) + "-" + p(date);
	                        dtime.push(now_a);
	                        sign.push(0);
	                        dpass.push(0);
	                    } else {
	                        for (var i = 0; i < res.data.count[0].length; i++) {
	                            dtime.push(res.data.count[0][i].day);
	                            sign.push(res.data.count[0][i].number)
	                        }
	                        for (var i = 0; i < res.data.count[1].length; i++) {
	                            dpass.push(res.data.count[1][i].number)
	                        }
	                    }

	                    //    -----------------------图表-----------------------------------
	                    var myChart = echarts.init(document.getElementById('main'));
	                    option = {
	                        tooltip: {
	                            trigger: 'axis',
	                            axisPointer: { // 坐标轴指示器，坐标轴触发有效
	                                type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
	                            }
	                        },
	                        legend: {
	                            data: ['录单人数', '通过人数']
	                        },
	                        toolbox: {
	                            show: true,
	                            orient: 'vertical',
	                            x: 'right',
	                            y: 'center',
	                            // feature: {
	                            // 	mark: {
	                            // 		show: true
	                            // 	},
	                            // 	dataView: {
	                            // 		show: true,
	                            // 		readOnly: false
	                            // 	},
	                            // 	magicType: {
	                            // 		show: true,
	                            // 		type: ['line', 'bar', 'stack', 'tiled']
	                            // 	},
	                            // 	restore: {
	                            // 		show: true
	                            // 	},
	                            // 	saveAsImage: {
	                            // 		show: true
	                            // 	}
	                            // }
	                        },
	                        calculable: true,
	                        xAxis: [{
	                            type: 'category',
	                            data: dtime
	                        }],
	                        yAxis: [{
	                            type: 'value'
	                        }],
	                        series: [{
	                            name: '录单人数',
	                            type: 'bar',
	                            data: sign,
	                            stack: '广告',
	                            itemStyle: {
	                                normal: {
	                                    color: function() {
	                                        var colorList = '#FD7910';
	                                        return colorList
	                                    },
	                                }
	                            },
	                        }, {
	                            name: '通过人数',
	                            type: 'bar',
	                            stack: '广告',
	                            data: dpass,
	                            itemStyle: {
	                                normal: {
	                                    color: function() {
	                                        var colorList = '#77d1db';
	                                        return colorList
	                                    },
	                                    　　　　　　　　　　　　　　
	                                }
	                            },
	                        }, ]
	                    };

	                    // 使用刚指定的配置项和数据显示图表。
	                    myChart.setOption(option);
	                },
	                error: function(res) {
	                    var str = res.responseText;
	                    var obj2 = eval("(" + str + ")");
	                    if (obj2.message) {
	                        alert(obj2.message)
	                    } else {
	                        alert(obj2.detail)
	                    }
	                    // $('.logout').click();　
	                }
	            });
	        },
	        paddingList: function(page) {
	            var order_nums = $('.order-argument input').eq(0).val();
	            var customer_name = $('.order-argument input').eq(1).val();
	            var product_name = $('.order-argument select').val();
	            var start_day = $('#datepicker-3').val();
	            var end_day = $('#datepicker-4').val();
	            $('.orders-tr').remove();
	            data = {
	                'order_num': order_nums,
	                'customer_name': customer_name,
	                'product_name': product_name,
	                'start_day': start_day,
	                'end_day': end_day
	            }
	            $.ajax({
	                type: "get",
	                url: host + "/channel/pending_list/?page=" + page,
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                data: data,
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	            }).done(function(res) {
	                console.log(res);
	                var data = res.data;
	                if (res.data) {
	                    $('.orderPaging').html('');
	                    var btr = '';
	                    var len = res.data.length;
	                    channelall.allpage = res.page.num_pages;
	                    if (bstop) {
	                        $("#page").initPage(channelall.allpage * 10, 1, GG.kk);
	                        bstop = false;
	                        tstop = true;
	                    }
	                    for (var i = 0; i < len; i++) {
	                        btr += '<tr class="orders-tr">' +
	                            '<td>' + (i + 1 + (page - 1) * 30) + '</td>' +
	                            '<td>' + data[i].order_num + '</td>' +
	                            '<td>' + data[i].customer_name + '</td>' +
	                            '<td>' + data[i].created + '</td>' +
	                            '<td>' + data[i].product_name + '</td>' +
	                            '<td>' + data[i].amount + '</td>' +
	                            '<td>' + data[i].term + '</td>' +
	                            '<td>' +
	                            '<div class="channel-table-alter xiangqing 100700" style="display:none">订单详情</div>' +
	                            '<div class="channel-table-alter fujian 100800" style="display:none">附件上传</div>' +
	                            '<div class="channel-table-alter uporder 101000" style="display:none">提交订单</div>' +
	                            '</td>' +
	                            '<td><div class="order_delete">删除<div></td>' +
	                            '</tr>';
	                    }
	                    $('#order-table').append(btr);
	                    if ($('.orders-tr').length == 0) {
	                        $('.pending-orders .some_page').hide();
	                    }
	                    for (var i = 0; i < permission.length; i++) {
	                        $('.' + permission[i] + '').show();
	                    }
	                }

	            });
	        },
	        orderlist: function(page) {
	            var data = {
	                'product': $('#channel-select .prodect-1').val(),
	                'state': $('.audits').val(),
	                'start_time': $('#datepicker-5').val(),
	                'end_time': $('#datepicker-6').val(),
	                'name': $('.select_name').val(),
	                'id_num': $('.select_id').val(),
	                'source': $('.select_from').val(),
	            }
	            $.ajax({
	                type: "GET",
	                url: host + "/channel/order_query/?page=" + page,
	                async: true,
	                data: data,
	                contentType: "application/json; charset=utf-8",
	                datatpye: 'json',
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                }
	            }).done(function(res) {
	                console.log(res);
	                $('.selecttr').remove();
	                var numlength = res.data.length;
	                var numtr = '';
	                for (var i = 0; i < numlength; i++) {
	                    numtr += '<tr class="selecttr">' +
	                        '<td>' + (i + 1 + (page - 1) * 30) + '</td>' +
	                        '<td>' + res.data[i].order_num + '</td>' +
	                        '<td>' + res.data[i].customer_name + '</td>' +
	                        '<td>' + res.data[i].product_name + '</td>' +
	                        '<td>' + res.data[i].term + '</td>' +
	                        '<td>' + res.data[i].source.source + '</td>' +
	                        '<td><p class="next_state">' + res.data[i].next_state + '</p><p class="rejectreason" style="color:red;">' + res.data[i].rejectreason + '</p></td>' +
	                        '<td><p class="se_amount">' + res.data[i].amount + '</p><p class="se_created">' + res.data[i].created + '</p></td>' +
	                        '<td><p class="se_confamount">' + res.data[i].confamount + '</p><p class="se_contract_date">' + res.data[i].contract_date + '</p></td>' +
	                        '<td><p class="se_handamount">' + res.data[i].handamount + '</p><p class="se_onhand_date">' + res.data[i].onhand_date + '</p></td>' +
	                        '<td>' + res.data[i].channel_user + '</td>' +
	                        '<td>' +
	                        '<div class="channel-table-alter xiangqingtwo">订单详情</div>' +
	                        '<div class="channel-table-alter fujiantwo">查看附件</div>' +
	                        '</td>' +
	                        '</tr>';

	                }
	                $('#select-table').append(numtr);
	                if ($('.selecttr').length == 0) {
	                    $('.channel_select .some_page').hide();
	                }
	                var selen = $('.se_confamount').length;
	                for (var i = 0; i < selen; i++) {
	                    if ($('.se_contract_date').eq(i).html() == '') {
	                        $('.se_confamount').eq(i).hide();
	                    }
	                    if ($('.se_onhand_date').eq(i).html() == '') {
	                        $('.se_handamount').eq(i).hide();
	                    }
	                }
	                channelall.allpage_two = res.page.num_pages;
	                if (astop) {
	                    $("#page_two").initPage(channelall.allpage_two * 10, 1, DD.HH);
	                    astop = false;
	                    cstop = true;
	                }

	            })
	        },
	        add_relations: function(obj) { //添加联系人
	            var tr_html = '<tr class="relation_list"><td><select name="" id="relations" style="width: 80px;height: 20px;"><option value="">--请选择--</option>';
	            for (var i = 0; i < channelall.data.relation.length; i++) {
	                tr_html += "<option value=" + channelall.data.relation[i].id + ">" + channelall.data.relation[i].name + "</option>";
	            }
	            tr_html += '</select></td><td><input type="text" id="relation_name" style="width: 80px;text-align: center;"/></td>' +
	                '<td><input type="text" id="relation_phone" maxlength="11" style="width: 100px;text-align: center;"/></td>' +
	                '<td><input type="text" id="relation_age" style="width: 20px; text-align: center;"/></td>' +
	                '<td><input type="text" id="relation_companyname" style="text-align: center;"/></td>' +
	                '<td><select name="" id="relation_know_loan" style="width: 50px;height: 20px;">' +
	                '<option value="1">是</option><option value="0">否</option></select></td><td><div class="channel-table-alter" onclick="channelall.confirm_relations(this)" style="margin-bottom: 0;">确认</div></td></tr>';
	            $(obj).parent().parent().before(tr_html);
	        },
	        confirm_relations: function(obj) { //确认联系人信息
	            var relation_name = $(obj).parent().parent().find("#relation_name").val();
	            var relations = $(obj).parent().parent().find("#relations").val();
	            var relation_phone = $(obj).parent().parent().find("#relation_phone").val();
	            var relation_age = $(obj).parent().parent().find("#relation_age").val();
	            var phone_reg = /^1[3|4|5|7|8]\d{9}$/;
	            var relation_companyname = $(obj).parent().parent().find("#relation_companyname").val();
	            if (relation_name == "") {
	                alert('请输入联系人姓名');
	            } else if (relations == "") {
	                alert('请选择联系人关系');
	            } else if (!phone_reg.test(relation_phone)) {
	                alert('请输入正确的手机号');
	            } else {
	                channelall.add_relations('.claddClick');
	                $(obj).parent().siblings().find("select").addClass('select_style');
	                $(obj).parent().siblings().find("select").attr("disabled", "disabled");
	                $(obj).parent().siblings().find("input").addClass('input_style');
	                $(obj).parent().siblings().find("input").attr("disabled", "disabled");
	                $(obj).parent().html('<div class="channel-table-alter" onclick="channelall.delete_relation(this)" style="margin-bottom: 0;">删除联系人</div><div class="channel-table-alter" onclick="channelall.modify_relation(this)" style="margin-bottom: 0;">修改</div>')
	            }
	        },
	        modify_relation: function(obj) { //修改联系人信息
	            $(obj).parent().siblings().find("select").removeClass('select_style');
	            $(obj).parent().siblings().find("select").removeAttr("disabled", "disabled");
	            $(obj).parent().siblings().find("input").removeClass('input_style');
	            $(obj).parent().siblings().find("input").removeAttr("disabled", "disabled");
	            $(obj).parent().html('<div class="channel-table-alter" onclick="channelall.confirm_relations(this)" style="margin-bottom: 0;">确认</div>');
	        },
	        delete_relation: function(obj) { //删除联系人
	            var perid = $(obj).parents('tr').find('td').eq(1).find('input').attr('sid');
	            var data = {
	                "order_num": orderNum,
	                id: perid
	            }
	            console.log(data)
	            $.ajax({
	                type: "delete",
	                url: host + "/channel/contact/",
	                data: JSON.stringify(data),
	                dataType: "json",
	                contentType: 'application/json',
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	                success: function(res) {
	                    console.log(res);

	                },
	                error: function(res) {
	                    var str = res.responseText;
	                    var obj2 = eval("(" + str + ")");
	                    if (obj2.message) {
	                        alert(obj2.message)
	                    } else {
	                        alert(obj2.detail)
	                    }　
	                }
	            })
	            $(obj).parent().parent().remove();

	        },
	        relation_submit: function(order_num) { //联系人信息提交保存
	            var data = {
	                "order_num": order_num
	            };
	            data.contacts = [];
	            $(".relation_list").each(function() {
	                var relation_obj = {};
	                relation_obj.name = $(this).find("#relation_name").val();
	                relation_obj.relation = $(this).find("#relations").val();
	                relation_obj.phone = $(this).find("#relation_phone").val();
	                relation_obj.age = $(this).find("#relation_age").val();
	                relation_obj.companyname = $(this).find("#relation_companyname").val();
	                relation_obj.is_knows = $(this).find("#relation_know_loan").val();
	                relation_obj.id = $(this).find("#relation_name").attr('sid');
	                if (relation_obj.name != '') {
	                    data.contacts.push(relation_obj);
	                }
	            });
	            if (data.contacts != []) {
	                console.log(data);
	                $.ajax({
	                    type: "POST",
	                    url: host + "/channel/order_contact_info/",
	                    data: JSON.stringify(data),
	                    dataType: "json",
	                    contentType: 'application/json',
	                    beforeSend: function(request) {
	                        var channeltoken = $.cookie('channeltoken');
	                        request.setRequestHeader("authorization", channeltoken);
	                    },
	                    success: function(data) {
	                        console.log(data);
	                        if (data.status == "success") {
	                            channelall.order_infos = data;
	                            var datas = data;
	                            console.log(datas);
	                            if (channelall.is_true(datas.customer)) {

	                            }
	                            $('.bank_list').remove()
	                            $('.channel-ask').eq(3).hide();
	                            $('.channel-ask').eq(4).show();
	                            $('.ask-logo-item p').eq(4).css({
	                                backgroundColor: '#FD7910',
	                            })
	                            $('.ask-logo-item h3').eq(3).css({
	                                backgroundColor: '#FD7910',
	                            })
	                            $('.ask-logo-item span').eq(4).css({
	                                color: '#FD7910',
	                            })

	                            $(document).scrollTop(0);
	                        } else {
	                            alert("联系人信息提交失败!");
	                        }
	                    },
	                    error: function(data) {
	                        var str = res.responseText;
	                        var obj2 = eval("(" + str + ")");
	                        if (obj2.message) {
	                            alert(obj2.message)
	                        } else {
	                            alert(obj2.detail)
	                        }　
	                    }
	                });
	            }
	        },
	        add_banks: function(obj) { //添加银行卡信息
	            var bank_html = '<tr class="bank_list"><td><span class="default_bank" is_know="0">(默)</span><input type="text" id="bank_account" style="width:180px;text-align: center;"/></td>' +
	                '<td><input type="text" maxlength="11" id="bank_name" style="width: 180px;text-align: center;"/></td>' +
	                '<td><input type="text" maxlength="11" id="bank_phone" style="width: 120px;text-align: center;"/></td>' +
	                '<td><div class="channel-table-alter" onclick="channelall.confirm_banks(this)" style="margin-bottom: 0;">确认</div></td></tr>';
	            $(obj).parent().parent().before(bank_html);
	        },
	        confirm_banks: function(obj) { //确认银行卡信息
	            var bank_account = $(obj).parent().parent().find("#bank_account").val();
	            var bank_name = $(obj).parent().parent().find("#bank_name").val();
	            var bank_phone = $(obj).parent().parent().find("#bank_phone").val();
	            var phone_reg = /^1[3|4|5|7|8]\d{9}$/;
	            if (bank_account != "" && bank_name != '' && phone_reg.test(bank_phone)) {
	                channelall.add_banks('.claddBank');
	                $(obj).parent().siblings().find("input").addClass('input_style');
	                $(obj).parent().siblings().find("input").attr("disabled", "disabled");
	                $(obj).parent().html('<div class="channel-table-alter" onclick="channelall.set_bank_default(this)" style="margin-bottom: 0;">设为默认</div><div class="channel-table-alter" onclick="channelall.delete_bank(this)" style="margin-bottom: 0;">删除此卡</div>');
	            } else {
	                alert('请补全信息并输入正确的手机号');
	            }
	        },
	        set_bank_default: function(obj) { //将银行卡设为默认卡
	            $(".bank_list").each(function() {
	                $(this).find("span").addClass("default_bank");
	                $(this).find("span").attr('is_know', '0');
	            })
	            $(obj).parent().siblings().find("span").removeClass('default_bank');
	            $(obj).parent().siblings().find("span").attr('is_know', '1');
	        },
	        delete_bank: function(obj) { //删除此银行卡
	            $(obj).parent().parent().remove();
	        },
	        bank_submit: function(order_nums) { //银行卡信息提交保存
	            var data = {
	                "order_num": order_nums
	            };
	            data.banks = [];
	            $(".bank_list").each(function() {
	                var bank_obj = {};
	                bank_obj.account = $(this).find("#bank_account").val();
	                bank_obj.name = $(this).find("#bank_name").val();
	                bank_obj.phone = $(this).find("#bank_phone").val();
	                bank_obj.is_main = $(this).find("span").attr('is_know');
	                if (bank_obj.account != '') {
	                    data.banks.push(bank_obj);
	                }
	            });
	            if (data.banks != []) {
	                console.log(data);
	                $.ajax({
	                    type: "POST",
	                    url: host + "/channel/order_bank_info/",
	                    data: JSON.stringify(data),
	                    dataType: "json",
	                    contentType: 'application/json',
	                    beforeSend: function(request) {
	                        var channeltoken = $.cookie('channeltoken');
	                        request.setRequestHeader("authorization", channeltoken);
	                    },
	                    success: function(data) {
	                        console.log(data);
	                        if (data.status == "success") {
	                            alert('提交成功');
	                            $(document).scrollTop(0);
	                            $('.orders').click();
	                            $('.channel-ask').hide();
	                            $('.channel-ask').eq(0).show();
	                        } else {
	                            alert("银行卡信息提交失败!");
	                        }
	                    },
	                    error: function(data) {
	                        var str = res.responseText;
	                        var obj2 = eval("(" + str + ")");
	                        if (obj2.message) {
	                            alert(obj2.message)
	                        } else {
	                            alert(obj2.detail)
	                        }　
	                    }
	                });
	            }
	        },
	        bank_submittwo: function(order_nums) { //银行卡信息提交保存
	            var data = {
	                "order_num": order_nums
	            };
	            data.banks = [];
	            $(".bank_list").each(function() {
	                var bank_obj = {};
	                bank_obj.account = $(this).find("#bank_account").val();
	                bank_obj.name = $(this).find("#bank_name").val();
	                bank_obj.phone = $(this).find("#bank_phone").val();
	                bank_obj.is_main = $(this).find("span").attr('is_know');
	                if (bank_obj.account != '') {
	                    data.banks.push(bank_obj);
	                }

	            })
	            console.log(data);
	            $.ajax({
	                type: "POST",
	                url: host + "/channel/order_bank_info/",
	                data: JSON.stringify(data),
	                dataType: "json",
	                contentType: 'application/json',
	                beforeSend: function(request) {
	                    var channeltoken = $.cookie('channeltoken');
	                    request.setRequestHeader("authorization", channeltoken);
	                },
	                success: function(data) {
	                    console.log(data);
	                    if (data.status == "success") {} else {
	                        alert("银行卡信息提交失败!");
	                    }
	                },
	                error: function(data) {
	                    var str = res.responseText;
	                    var obj2 = eval("(" + str + ")");
	                    if (obj2.message) {
	                        alert(obj2.message)
	                    } else {
	                        alert(obj2.detail)
	                    }　
	                }
	            });
	        },
	        is_true: function(data) { //判断data是否为null或者""或者undefined, 是则返回false并且将值改为"",否则返回true
	            if (data != null && data != "" && data != undefined && data != "undefined") {
	                return true;
	            } else {
	                data = "";
	                return false;
	            }
	        },
	        productread: function(id) {
	            // $('.zhezhao').show();
	            // $('.productread').load('html/product_read.html', function() {
	            //     $.ajax({
	            //             url: host + '/channel/product_detail/',
	            //             type: 'get',
	            //             dataType: 'json',
	            //             data: { 'product_id': id },
	            //             contentType: 'application/json',
	            //             beforeSend: function(request) {
	            //                 var channeltoken = $.cookie('channeltoken');
	            //                 request.setRequestHeader("authorization", channeltoken);
	            //             },
	            //         })
	            //         .done(function(res) {
	            //             console.log(res);
	            //             $('.prodcutinfo_left').find('p').eq(0).find('i').html(res.data.name)
	            //             $('.prodcutinfo_left').find('p').eq(1).find('i').html(res.data.totalamount)
	            //             $('.prodcutinfo_left').find('p').eq(2).find('i').html(res.data.yearrate)
	            //             $('.prodcutinfo_left').find('p').eq(3).find('i').html(res.data.penalty_type.name)
	            //             $('.prodcutinfo_left').find('p').eq(4).find('i').html(res.data.latefee)
	            //             $('.prodcutinfo_left').find('p').eq(5).find('i').html(res.data.translate.state)
	            //             $('.prodcutinfo_left').find('p').eq(6).find('i').html(res.data.remark)
	            //             $('.prodcutinfo_right').find('p').eq(0).find('i').html(res.data.remark)
	            //             $('.prodcutinfo_right').find('p').eq(1).find('i').html(res.data.type.name)
	            //             $('.prodcutinfo_right').find('p').eq(2).find('i').html(res.data.repayment.name)
	            //             $('.prodcutinfo_right').find('p').eq(3).find('i').html(res.data.penalty)
	            //             $('.prodcutinfo_right').find('p').eq(4).find('i').html(res.data.servicefee)
	            //             $('.prodcutinfo_right').find('p').eq(5).find('i').html(res.data.related_order_flag.state)
	            //         })

	            //     $('.zhezhao').on('click', function() {
	            //         $('.productread').html('');
	            //     });
	            // })
	        },
	        intolist: function() {
	            $.ajax({
	                    url: host + '/channel/investigation_list/',
	                    type: 'get',
	                    contentType: "application/json; charset=utf-8",
	                    datatpye: 'json',
	                    data: {
	                        'next_state': '160200',
	                        'order_num': $('.into_id').val(),
	                        'start_time': $('#datepicker-7').val(),
	                        'end_time': $('#datepicker-8').val(),
	                        'product': $('.channel_into .prodect-1').val(),
	                        'name': $('.into_name').val(),
	                    },
	                    beforeSend: function(request) {
	                        var channeltoken = $.cookie('channeltoken');
	                        request.setRequestHeader("authorization", channeltoken);
	                    },
	                })
	                .done(function(res) {
	                    console.log(res);

	                })
	                .fail(function(res) {
	                    console.log(res);
	                })
	        }
	    }
	    //	------------------操作员删除-----------------
	function peratordelete(id, pk, object) {
	    if (id == 0) {
	        var result = confirm('是否要停用该用户');
	    }
	    if (id == 1) {
	        var result = true;
	    }
	    if (result == true) {
	        $.ajax({
	            type: "get",
	            url: host + "/channel/user_state/",
	            async: true,
	            data: {
	                id: pk,
	                state: id,
	                module: 'channel'
	            },
	            dataType: "json",
	            contentType: 'application/json',
	            beforeSend: function(request) {
	                var channeltoken = $.cookie('channeltoken');
	                request.setRequestHeader("authorization", channeltoken);
	            },
	            success: function(res) {
	                console.log(res);
	                $('.channel-content-click').eq(3).click();
	            },
	            error: function(res) {
	                var str = res.responseText;
	                var obj2 = eval("(" + str + ")");
	                if (obj2.message) {
	                    alert(obj2.message)
	                } else {
	                    alert(obj2.detail)
	                }　
	            }
	        });
	    }
	}

	//操作员修改
	function peratorput(pk, object) {
	    $.ajax({
	        type: "get",
	        url: host + "/channel/init_form/",
	        async: true,
	        data: {
	            "id": pk,
	            "module": 'channel'
	        },
	        datatpye: 'json',
	        contentType: "application/json; charset=utf-8",
	        beforeSend: function(request) {
	            var channeltoken = $.cookie('channeltoken');
	            request.setRequestHeader("authorization", channeltoken);
	        },
	        success: function(res) {
	            console.log(res);
	            $('#channel-allcontent').load('html/channel-add.html', function() {
	                $('.channel_height').css('minHeight', $(document).height() - 62);
	                $('.channel-swipers').css('minHeight', $(document).height() - 147);
	                gotoindex();
	                gotooperator();
	                $('.changei').html('操作员修改');
	                var bbtn = '';
	                var data = res.data.permission;
	                for (var i = 0; i < data.length; i++) {
	                    if (data[i].state == 0) {
	                        bbtn += '<input type="button" value="' + data[i].name + '" id="' + data[i].code + '" class="channel-btn"/>';
	                    }
	                    if (data[i].state == 1) {
	                        bbtn += '<input style="background:#FD7910;color:white" type="button" value="' + data[i].name + '" id="' + data[i].code + '" class="channel-btn"/>';
	                    }
	                }
	                $('.jurisdiction').append(bbtn);
	                var bst = '';
	                for (var i = 0; i < res.data.leaders.length; i++) {
	                    bst += '<option value="' + res.data.leaders[i].pk + '">' + res.data.leaders[i].realname + '</option>'
	                }
	                $('#channelleader').append(bst);
	                $('#channelnameres').attr('disabled', 'disabled');
	                $('#channelnameres').val(res.data.username);
	                $('#channelrealname').val(res.data.realname);
	                $('#channelemail').val(res.data.email);
	                $('#channelphone').val(res.data.phone);
	                $("#channelleader option[value='" + res.data.leader + "']").attr("selected", "selected");

	                $('.add-tijiao input').eq(1).on('click', function() {
	                    $('#channelnameres').val($(object).parent().parent().find('td').eq(0).html());
	                    $('#channelrealname').val($(object).parent().parent().find('td').eq(1).html());
	                    $('#channelemail').val($(object).parent().parent().find('td').eq(3).html());
	                    $('#channelphone').val($(object).parent().parent().find('td').eq(2).html());
	                    $('.channel-btn').css({
	                        backgroundColor: 'white',
	                        color: 'black'
	                    });
	                })
	                $('.channel-btn').each(function() {
	                    var bstop = true;
	                    $(this).on("click", function() {
	                        if ($(this).css('color') == 'rgb(0, 0, 0)') {
	                            bstop = true;
	                        } else if ($(this).css('color') == 'rgb(255, 255, 255)') {
	                            bstop = false;
	                        }
	                        if (bstop == true) {
	                            $(this).css({
	                                backgroundColor: '#FD7910',
	                                color: 'white'
	                            });
	                            bstop = false;
	                        } else {
	                            $(this).css({
	                                backgroundColor: 'white',
	                                color: 'black'
	                            });
	                            bstop = true;
	                        }
	                    })
	                });

	                $('.resetpassword').on('click', function() {
	                    var name = $('#channelnameres').val();
	                    var phone = $('#channelphone').val();
	                    var creset = {
	                        "username": name,
	                        "phone": phone,
	                        "id": pk,
	                        'module': 'channel',
	                    }
	                    $.ajax({
	                        type: "get",
	                        url: host + "/channel/send_password/",
	                        async: true,
	                        data: creset,
	                        datatpye: 'json',
	                        contentType: "application/json; charset=utf-8",
	                        beforeSend: function(request) {
	                            var channeltoken = $.cookie('channeltoken');
	                            request.setRequestHeader("authorization", channeltoken);
	                        },
	                        success: function(res) {
	                            console.log(res);
	                            alert(res.message)
	                        },
	                        error: function(res) {
	                            var str = res.responseText;
	                            var obj2 = eval("(" + str + ")");
	                            if (obj2.message) {
	                                alert(obj2.message)
	                            } else {
	                                alert(obj2.detail)
	                            }　
	                        }

	                    })
	                })


	                $('.add-tijiao input').eq(0).on('click', function() {
	                    var name = $('#channelnameres').val();
	                    var realname = $('#channelrealname').val();
	                    var email = $('#channelemail').val();
	                    var phone = $('#channelphone').val();
	                    var leaders = $('#channelleader').val();
	                    var codeall = [];
	                    $('.channel-btn').each(function() {
	                        if ($(this).css('color') == 'rgb(255, 255, 255)') {
	                            codeall.push($(this).attr('id'));
	                        }
	                    });
	                    var data = {
	                        'username': name,
	                        'realname': realname,
	                        'email': email,
	                        'phone': phone,
	                        'codes': codeall,
	                        'pk': pk,
	                        'leader': leaders
	                    };
	                    console.log(data)
	                    $.ajax({
	                        type: "put",
	                        url: host + "/channel/handleuser/",
	                        async: true,
	                        data: JSON.stringify(data),
	                        datatpye: 'json',
	                        contentType: "application/json; charset=utf-8",
	                        beforeSend: function(request) {
	                            var channeltoken = $.cookie('channeltoken');
	                            request.setRequestHeader("authorization", channeltoken);
	                        },
	                        success: function(res) {
	                            console.log(res)
	                            alert('修改成功');
	                            $('.channel-content-click').eq(3).click();
	                        },
	                        error: function(res) {
	                            var str = res.responseText;
	                            var obj2 = eval("(" + str + ")");
	                            if (obj2.message) {
	                                alert(obj2.message)
	                            } else {
	                                alert(obj2.detail)
	                            }　
	                        }
	                    });
	                })
	            })
	        },
	        error: function(res) {
	            var str = res.responseText;
	            var obj2 = eval("(" + str + ")");
	            if (obj2.message) {
	                alert(obj2.message)
	            } else {
	                alert(obj2.detail)
	            }　
	        }

	    });

	}
	//事件
	$('.province').eq(0).change(function() {
	    $('.options-six').remove();
	    $('.options-three').remove();
	    var code = $('.province').val();
	    channelall.getCities(code);
	    channelall.citiesTypefive(channelall.city, '.cities');
	    channelall.citiesTypeTwo(channelall.city, '.cities-2');
	});
	$('.province-2').eq(0).change(function() {
	    $('.options-three').remove();
	    var code = $('.province-2').val();
	    channelall.getCities(code);
	    channelall.citiesTypeTwo(channelall.city, '.cities-2');

	});
	$('.cities').eq(0).change(function() {
	    $('.area').html('');
	    $('.area-2').html('<option value=""></option>');
	    var code = $('.cities').val();
	    channelall.getArea(code);
	    channelall.citiesTypefive(channelall.area, '.area');
	    channelall.citiesTypeTwo(channelall.area, '.area-2');
	});
	$('.cities-2').eq(0).change(function() {
	    $('.area-2').html('<option value=""></option>');
	    var code = $('.cities-2').val();
	    channelall.getArea(code);
	    channelall.citiesTypeTwo(channelall.area, '.area-2');

	});
	$('.province-3').change(function() {
	    $('.options-five').remove();
	    var code = $('.province-3').val();
	    channelall.getCities(code);
	    channelall.citiesTypefour(channelall.city, '.cities-3');

	});
	$('.cities-3').change(function() {
	    $('.area-five').html('');
	    var code = $('.cities-3').val();
	    channelall.getArea(code);
	    channelall.citiesTypefour(channelall.area, '.area-3');
	});

	function progressHandlingFunction(e) {
	    if (e.lengthComputable) {
	        $('#progressLi').show()
	        $('#progressNum').html((e.loaded / e.total * 100).toFixed(0) + '%')
	        $('#progress').width((e.loaded / e.total * 100).toFixed(0) + '%')
	        if ((e.loaded / e.total * 100).toFixed(0) >= 100) {
	            $('#progressLi').hide()
	        }
	    }
	}

	function picdownload(obj, orderNum, id) {

	    //		console.log($(obj).parent().parent().find('div').html())
	    //图片上传缩略图的实现
	    var order_numRq = orderNum;
	    var formdata = new FormData()
	    formdata.append("order_num", order_numRq);
	    formdata.append("filetype", id);
	    for (var i = 0; i < $(obj)[0].files.length; i++) {
	        formdata.append("image", $(obj)[0].files[i]);
	    }
	    channelall.obja = obj;
	    $.ajax({
	        type: "post",
	        url: host + "/channel/attached_files/",
	        data: formdata,
	        cache: false,
	        xhr: function() { //获取ajaxSettings中的xhr对象，为它的upload属性绑定progress事件的处理函数  
	            myXhr = $.ajaxSettings.xhr();
	            if (myXhr.upload) { //检查upload属性是否存在  
	                //绑定progress事件的回调函数  
	                myXhr.upload.addEventListener('progress', progressHandlingFunction, false);
	            } else {}
	            return myXhr; //xhr对象返回给jQuery使用  
	        },
	        processData: false, // 不处理发送的数据，因为data值是Formdata对象，不需要对数据做处理
	        contentType: false,
	        beforeSend: function(request) {
	            var channeltoken = $.cookie('channeltoken');
	            request.setRequestHeader("authorization", channeltoken);
	        },
	        success: function(res) {
	            console.log(res);
	            var str = ""
	            for (var i = 0; i < res.data.length; i++) {
	                str += '<h4>' +
	                    '<img src="' + imghost + res.data[i].thumbnail + '" sid="' + res.data[i].id + '" />' +
	                    '<a href="javascript:;" class="picremove" onclick="picremove(' + res.data[i].id + ',this)">删除</a>' +
	                    '</h4>'
	            }
	            $(obj).parent().parent().find('div').append(str);
	            $(obj).parent().find('i').html($(obj).parent().parent().find('.homepic').find('h4').length)
	            $(channelall.fujian).click();
	        },
	        error: function(res) {
	            var str = res.responseText;
	            var obj2 = eval("(" + str + ")");
	            if (obj2.message) {
	                alert(obj2.message)
	            } else {
	                alert(obj2.detail)
	            }　
	        }

	    })
	};

	function picremove(id, obj) {
	    var data = {
	        'order_num': orderNum,
	        'id': id
	    }
	    console.log(data)
	    $.ajax({
	        type: "delete",
	        url: host + "/channel/file/",
	        async: true,
	        data: JSON.stringify(data),
	        datatpye: 'json',
	        contentType: "application/json; charset=utf-8",
	        beforeSend: function(request) {
	            var channeltoken = $.cookie('channeltoken');
	            request.setRequestHeader("authorization", channeltoken);
	        },
	        success: function(res) {
	            console.log(res);
	            $(obj).parent().remove();
	            $(channelall.fujian).click();
	        },
	        error: function(res) {
	            var str = res.responseText;
	            var obj2 = eval("(" + str + ")");
	            if (obj2.message) {
	                alert(obj2.message)
	            } else {
	                alert(obj2.detail)
	            }　
	        }
	    });
	}
	$('.padding-select').on('click', function() {
	    $('.pending-orders .some_page').show();
	    tstop = false;
	    channelall.paddingList(1);
	    bstop = true;

	});
	$('.orderchange').on('change', function() {
	    var sval = $(this).val();
	    $.ajax({
	        type: "get",
	        url: host + "/channel/product_repay/",
	        async: true,
	        data: {
	            "id": sval
	        },
	        contentType: "application/json; charset=utf-8",
	        datatpye: 'json',
	        beforeSend: function(request) {
	            var channeltoken = $.cookie('channeltoken');
	            request.setRequestHeader("authorization", channeltoken);
	        },
	        success: function(res) {
	            console.log(res);
	            $('.returntype').val(res.data.name);
	        },
	        error: function(res) {
	            var str = res.responseText;
	            var obj2 = eval("(" + str + ")");
	            if (obj2.message) {
	                alert(obj2.message)
	            } else {
	                alert(obj2.detail)
	            }　
	        }
	    });
	});
	$('.province-2').on('focus', function() {
	    $('.province-2 option').eq(0).text('请选择');
	});
	$('.job_type').on('change', function() {

	    if ($(this).val() == 13) {
	        $('.job_type_other').removeAttr('disabled');
	    } else {
	        $('.job_type_other').attr('disabled', 'disabled');
	        $('.job_type_other').val('')
	    }
	});
	$('.company_type').on('change', function() {
	    if ($(this).val() == 6) {
	        $('.company_type_other').removeAttr('disabled');
	    } else {
	        $('.company_type_other').attr('disabled', 'disabled');
	        $('.company_type_other').val('')
	    }
	});
	//尽调
	$('.into_select').on('click', function() {
	        channelall.intolist();
	    })
	    //数据报表
	$('.channel-header-click').eq(5).on('click', function() {
	    $.ajax({
	            type: 'get',
	            url: host + '/channel/data_report/',
	            contentType: "application/json; charset=utf-8",
	            datatpye: 'json',
	            data: {
	                'time_limit': '7'
	            },
	            beforeSend: function(request) {
	                var channeltoken = $.cookie('channeltoken');
	                request.setRequestHeader("authorization", channeltoken);
	            },
	        })
	        .done(function(res) {
	            console.log(res);
	            $.get('json/zhejiang.json', function(geoJson) {
	                echarts.registerMap('zhejiang', geoJson);
	                var myChart = echarts.init(document.getElementById('maindata'));

	                myChart.setOption(option = {
	                    title: {
	                        text: '浙江',
	                    },
	                    tooltip: {
	                        trigger: 'item',
	                        formatter: '{b}<br/>{c} (人)'
	                    },
	                    toolbox: {
	                        show: true,
	                        orient: 'vertical',
	                        left: 'right',
	                        top: 'center',
	                        feature: {
	                            dataView: {
	                                readOnly: false
	                            },
	                            restore: {},
	                            saveAsImage: {}
	                        }
	                    },
	                    visualMap: {
	                        min: 800,
	                        max: 50000,
	                        text: ['High', 'Low'],
	                        realtime: false,
	                        calculable: true,
	                        inRange: {
	                            color: ['lightskyblue', 'yellow', 'orangered']
	                        }
	                    },
	                    series: [{
	                        name: '浙江人数',
	                        type: 'map',
	                        mapType: 'zhejiang', // 自定义扩展图表类型
	                        itemStyle: {
	                            normal: {
	                                label: {
	                                    show: true
	                                }
	                            },
	                            emphasis: {
	                                label: {
	                                    show: true
	                                }
	                            }
	                        },
	                        data: [{
	                                name: '温州市',
	                                value: 20057.34
	                            }, {
	                                name: '杭州市',
	                                value: 500.34
	                            },

	                        ],

	                    }]
	                });
	            });

	        })
	        .fail(function(res) {
	            console.log(res);
	        })

	});
	// 时间前面的0
	function p(s) {
	    return s < 10 ? '0' + s : s;
	};
	// 进度条
	function progressHandlingFunction(e) {
	    // console.log($(channelall.obja).parent().parent().find('.progress_bar').find('.progress_barinfo').html())
	    if (e.lengthComputable) {

	        $(channelall.obja).parent().parent().find('.progress_bar').show();
	        $(channelall.obja).parent().parent().find('.progress_bar').find('.progress_barinfo').html((e.loaded / e.total * 100).toFixed(0) + '%');
	        $(channelall.obja).parent().parent().find('.progress_bar').find('.progress_barinfo').width((e.loaded / e.total * 100).toFixed(0) + '%');
	        if ((e.loaded / e.total * 100).toFixed(0) >= 100) {
	            $(channelall.obja).parent().parent().find('.progress_bar').hide();
	        }
	    }
	};
	//是否有房产
	$('.ishavehome').on('change', function() {
	    if ($(this).val() == 0) {
	        $('.checkbtn').show();
	        $('.houseaddress').show();
	        $('.house_address').parent().show();
	        $('.samehouse').show();

	    }
	    if ($(this).val() == 1) {
	        $('.checkbtn').hide();
	        $('.houseaddress').hide();
	        $('.house_address').parent().hide();
	        $('.samehouse').hide();
	    }
	});
	//月份中文版
	function monthName(obj) {
	    $(obj).datepicker({
	        dateFormat: "yy-mm-dd"
	    });
	    $(obj).datepicker("option", "dayNamesMin", ["日", "一", "二", "三", "四", "五", "六"]);
	    //月份格式汉化  
	    $(obj).datepicker("option", "monthNames", ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]);
	};
	//-----------------------------返回首页-----------------------------------
	function gotoindex() {
	    $('.goindex ').on('click', function() {
	        $('.channel-header-click').eq(0).click();
	    });
	};
	// ----------------------------返回操作员管理--------------------------------------------
	function gotooperator() {
	    $('.gooperator ').on('click', function() {
	        $('.channel-content-click').eq(3).click();
	    });
	}
	//--------------------------------返回申请页面------------------------------------------
	function gotoorder() {
	    $('.goorder').on('click', function() {
	        $('.channel-header-click').eq(1).click();
	    });
	};
	//	------------------------------返回查询页面------------------------------------------
	function gotoselect() {
	    $('.goordertwo').on('click', function() {
	        $('.channel-header-click').eq(3).click();
	    });
	};

	// -------------------------------退出------------------------------------------------------

	$('.logout').on('click', function() {
	    window.location.href = 'login.html';
	    $.cookie('channeltoken', null);
	    $.cookie('permisssion', null);
	    $.ajax({
	            url: host + '/channel/logout/',
	            type: 'get',
	            contentType: "application/json; charset=utf-8",
	            datatpye: 'json',
	            beforeSend: function(request) {
	                var channeltoken = $.cookie('channeltoken');
	                request.setRequestHeader("authorization", channeltoken);
	            },
	        })
	        .done(function(res) {

	        })

	});

	// ---------------------调用高拍仪---------------------------------------
	function picget(filetype, id) {
	    channelall.filetype_name = filetype;
	    channelall.filetype = id;
	    $('.gaopaiyi').css('left', '50%');
	    captrue.bStartPlay();
	}

	function uploadpic() {
	    var math = parseInt(Math.random() * 100000);
	    captrue.bSaveJPG("C:\\Users\\Public\\Pictures\\", math);
	    UpLoadJPG_onclick(math);
	    $(channelall.fujian).click();
	}

	function UpLoadJPG_onclick(math) {
	    var channeltoken = $.cookie('channeltoken');
	    captrue.bUpLoadImage("C:\\Users\\Public\\Pictures\\" + math + ".jpg", "114.215.252.114", 8000, "/channel/ocx_file/" + orderNum + "/" + channelall.filetype_name + "/" + channeltoken + "/" + channelall.filetype + "/");
	}
	// -----------------关闭高拍仪------------------------------------------
	$('.channel_close').on('click', function() {
	    $('.gaopaiyi').css('left', '-99999px');
	    captrue.bStopPlay();
	})
